<?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', 'd/m/Y H:i', '06/11/1992'));
- Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.25, 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- string(16) "06/11/1992 12:07"
- Output for 7.3.32 - 7.3.33, 8.0.13
- string(16) "06/11/1992 11:07"
- Output for 7.0.6
- string(16) "06/11/1992 06:52"
- Output for 7.0.5
- string(16) "06/11/1992 19:53"
- Output for 7.0.4
- string(16) "06/11/1992 06:01"
- Output for 7.0.3
- string(16) "06/11/1992 06:27"
- Output for 7.0.2
- string(16) "06/11/1992 11:59"
- Output for 7.0.1
- string(16) "06/11/1992 17:23"
- Output for 7.0.0
- string(16) "06/11/1992 19:06"
- Output for 5.6.21
- string(16) "06/11/1992 02:09"
- Output for 5.6.20
- string(16) "06/11/1992 15:10"
- Output for 5.6.19
- string(16) "06/11/1992 06:59"
- Output for 5.6.18
- string(16) "06/11/1992 20:06"
- Output for 5.6.17
- string(16) "06/11/1992 10:48"
- Output for 5.5.28, 5.6.16
- string(16) "06/11/1992 20:51"
- Output for 5.6.15
- string(16) "06/11/1992 21:43"
- Output for 5.6.14
- string(16) "06/11/1992 00:12"
- Output for 5.6.13
- string(16) "06/11/1992 04:16"
- Output for 5.6.12
- string(16) "06/11/1992 17:47"
- Output for 5.6.11
- string(16) "06/11/1992 00:45"
- Output for 5.6.10
- string(16) "06/11/1992 02:36"
- Output for 5.6.9
- string(16) "06/11/1992 07:35"
- Output for 5.6.8
- string(16) "06/11/1992 15:29"
- Output for 5.6.7
- string(16) "06/11/1992 07:20"
- Output for 5.5.35
- string(16) "06/11/1992 05:47"
- Output for 5.5.34
- string(16) "06/11/1992 21:07"
- Output for 5.5.33
- string(16) "06/11/1992 16:55"
- Output for 5.5.32
- string(16) "06/11/1992 22:57"
- Output for 5.5.31
- string(16) "06/11/1992 13:37"
- Output for 5.5.30
- string(16) "06/11/1992 23:43"
- Output for 5.5.29
- string(16) "06/11/1992 18:21"
- Output for 5.5.27
- string(16) "06/11/1992 23:18"
- Output for 5.5.26
- string(16) "06/11/1992 05:02"
- Output for 5.5.25
- string(16) "06/11/1992 11:05"
- Output for 5.5.24
- string(16) "06/11/1992 17:59"
- Output for 5.4.41 - 5.4.45
- string(16) "06/11/1992 00:29"
- Output for 5.4.39 - 5.4.40
- string(16) "06/11/1992 13:27"
- Output for 5.4.38
- string(16) "06/11/1992 10:14"
- Output for 5.4.36 - 5.4.37
- string(16) "06/11/1992 05:30"
- Output for 5.4.34 - 5.4.35
- string(16) "06/11/1992 21:45"
- Output for 5.3.29, 5.4.26 - 5.4.32
- string(16) "06/11/1992 19:32"
- Output for 5.2.0 - 5.2.17
- Fatal error: Call to undefined function date_create_from_format() in /in/sHIkN on line 8
Process exited with code 255. - Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
- Fatal error: Class 'DateTimeZone' not found in /in/sHIkN on line 5
Process exited with code 255. - Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
- Fatal error: Cannot instantiate non-existent class: datetimezone in /in/sHIkN 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/sHIkN on line 5
preferences:
284.34 ms | 401 KiB | 359 Q