3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function converteData($format, $to_format, $time, $timezone = null) { if (!$timezone) { $timezone = new DateTimeZone(date_default_timezone_get()); } $d = date_create_from_format($format, $time, $timezone); return date_format($d, $to_format); } var_dump(converteData('d/m/Y', 'Y-m-d H:i:s', '06/11/1992'));
Output for 5.6.28, 7.0.14 - 7.1.0
string(19) "1992-11-06 12:07:38"
Output for 7.0.6
string(19) "1992-11-06 06:52:51"
Output for 7.0.5
string(19) "1992-11-06 19:53:22"
Output for 7.0.4
string(19) "1992-11-06 06:01:05"
Output for 7.0.3
string(19) "1992-11-06 06:27:45"
Output for 7.0.2
string(19) "1992-11-06 11:59:29"
Output for 7.0.1
string(19) "1992-11-06 17:23:47"
Output for 7.0.0
string(19) "1992-11-06 19:06:03"
Output for hhvm-3.12.0
string(19) "1992-11-06 15:07:13"
Output for hhvm-3.10.0
string(19) "1992-11-06 04:00:44"
Output for 5.6.21
string(19) "1992-11-06 02:09:56"
Output for 5.6.20
string(19) "1992-11-06 15:10:05"
Output for 5.6.19
string(19) "1992-11-06 06:59:39"
Output for 5.6.18
string(19) "1992-11-06 20:05:59"
Output for 5.6.17
string(19) "1992-11-06 10:48:26"
Output for 5.6.16
string(19) "1992-11-06 20:50:59"
Output for 5.6.15
string(19) "1992-11-06 21:43:30"
Output for 5.6.14
string(19) "1992-11-06 00:12:03"
Output for 5.6.13
string(19) "1992-11-06 04:16:05"
Output for 5.6.12
string(19) "1992-11-06 17:47:29"
Output for 5.6.11
string(19) "1992-11-06 00:45:42"
Output for 5.6.10
string(19) "1992-11-06 02:36:54"
Output for 5.6.9
string(19) "1992-11-06 07:35:42"
Output for 5.6.8
string(19) "1992-11-06 15:29:21"
Output for 5.6.7
string(19) "1992-11-06 07:20:43"
Output for 5.5.35
string(19) "1992-11-06 05:47:31"
Output for 5.5.34
string(19) "1992-11-06 21:07:47"
Output for 5.5.33
string(19) "1992-11-06 16:54:58"
Output for 5.5.32
string(19) "1992-11-06 22:57:40"
Output for 5.5.31
string(19) "1992-11-06 13:37:11"
Output for 5.5.30
string(19) "1992-11-06 23:43:15"
Output for 5.5.29
string(19) "1992-11-06 18:21:14"
Output for 5.5.28
string(19) "1992-11-06 20:51:20"
Output for 5.5.27
string(19) "1992-11-06 23:18:09"
Output for 5.5.26
string(19) "1992-11-06 05:02:50"
Output for 5.5.25
string(19) "1992-11-06 11:05:31"
Output for 5.5.24
string(19) "1992-11-06 17:59:43"
Output for 5.4.45
string(19) "1992-11-06 00:29:31"
Output for 5.4.44
string(19) "1992-11-06 00:29:28"
Output for 5.4.43
string(19) "1992-11-06 00:29:24"
Output for 5.4.42
string(19) "1992-11-06 00:29:23"
Output for 5.4.41
string(19) "1992-11-06 00:29:21"
Output for 5.4.40
string(19) "1992-11-06 13:27:43"
Output for 5.4.39
string(19) "1992-11-06 13:27:42"
Output for 5.4.38
string(19) "1992-11-06 10:14:43"
Output for 5.4.37
string(19) "1992-11-06 05:29:56"
Output for 5.4.36
string(19) "1992-11-06 05:29:55"
Output for 5.4.35
string(19) "1992-11-06 21:45:50"
Output for 5.4.34
string(19) "1992-11-06 21:45:49"
Output for 5.4.32
string(19) "1992-11-06 19:33:11"
Output for 5.4.31
string(19) "1992-11-06 19:33:07"
Output for 5.4.28 - 5.4.30
string(19) "1992-11-06 19:33:03"
Output for 5.4.27
string(19) "1992-11-06 19:33:09"
Output for 5.4.26
string(19) "1992-11-06 19:33:08"
Output for 5.4.17 - 5.4.25
string(19) "1992-11-06 12:07:39"
Output for 5.3.24 - 5.3.28, 5.4.0 - 5.4.16
string(19) "1992-11-06 12:07:40"
Output for 5.3.29
string(19) "1992-11-06 19:33:04"
Output for 5.3.4 - 5.3.23
string(19) "1992-11-06 12:07:41"
Output for 5.3.0 - 5.3.3
string(19) "1992-11-06 12:07:42"
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined function date_create_from_format() in /in/vf7qi on line 8
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/vf7qi on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/vf7qi on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/vf7qi on line 5