3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $UTC_offset = '+03:30'; $utc = new \DateTimeZone('UTC'); $date = new \DateTime('now', $utc); var_dump($date); $timezone = new \DateTimeZone(str_replace(':', '', $UTC_offset)); $date->setTimezone($timezone); var_dump($date);
based on EvKbJ
Output for 7.2.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.002794" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.002794" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.1.10
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.003002" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.003002" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.1.7
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.002987" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.002987" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.1.6
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.012396" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.012396" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.1.5
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.011209" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.011209" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.1.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.004022" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.004022" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.28, 7.0.20
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.0.6
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-21 11:50:38.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-21 15:20:38.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.0.5
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-03 07:47:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-03 11:17:55.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.0.4
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-10 20:55:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-11 00:25:19.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.0.3
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-18 22:23:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-19 01:53:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.0.2
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-23 04:36:55.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-23 08:06:55.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.0.1
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-24 07:40:04.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-24 11:10:04.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 7.0.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-27 08:33:01.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-27 12:03:01.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.21
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-02 14:42:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-02 18:12:15.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.20
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-10 06:50:15.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-10 10:20:15.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.19
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-08 05:05:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-08 08:35:03.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.18
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-15 14:03:19.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-15 17:33:19.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.17
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-20 01:35:39.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-20 05:05:39.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.16
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-28 09:22:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-28 12:52:52.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.15
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-29 10:12:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-29 13:42:26.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.14
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-14 15:54:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-14 19:24:53.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.13
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-15 16:33:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-15 20:03:56.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.12
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-20 07:03:57.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-20 10:33:57.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.11
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-24 13:30:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-24 17:00:03.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.10
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-25 15:35:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-25 19:05:37.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.9
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-27 21:03:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-28 00:33:36.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.6.8
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-30 05:30:33.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-30 09:00:33.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.35
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-23 00:46:02.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-23 04:16:02.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.34
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-11 09:05:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-11 12:35:09.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.33
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-09 08:04:10.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-09 11:34:10.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.32
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-17 18:01:06.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-17 21:31:06.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.31
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-21 04:47:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-21 08:17:37.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.30
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 12:03:46.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 15:33:46.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.29
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-17 06:51:34.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-17 10:21:34.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.28
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-21 10:23:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-21 13:53:37.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.27
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-22 12:01:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-22 15:31:08.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.26
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-26 18:17:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-26 21:47:08.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.25
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-29 01:43:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-29 05:13:31.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.5.24
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-24 08:14:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-24 11:44:52.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for 5.4.45
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:21.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.4.43 - 5.4.44
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.4.41 - 5.4.42
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:23.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.4.40
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:24.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.4.37 - 5.4.39
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.4.35 - 5.4.36
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.4.32 - 5.4.34
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.4.30 - 5.4.31
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.3.29, 5.4.29
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-15 06:26:28" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.4.25 - 5.4.28
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-15 06:26:29" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.3.28, 5.4.22 - 5.4.24
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-15 06:26:30" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.4.19 - 5.4.21
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-15 06:26:31" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.3.26 - 5.3.27, 5.4.16 - 5.4.18
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-15 06:26:32" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.3.22 - 5.3.25, 5.4.12 - 5.4.15
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-15 06:26:33" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.
Output for 5.3.21, 5.4.11
object(DateTime)#2 (3) { ["date"]=> string(19) "2016-01-15 06:26:34" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (+0330)' in /in/S1e3M:7 Stack trace: #0 /in/S1e3M(7): DateTimeZone->__construct('+0330') #1 {main} thrown in /in/S1e3M on line 7
Process exited with code 255.