3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $userTimezone = new \DateTimeZone('Europe/Helsinki'); $from = new \DateTime( 'now', $userTimezone ); $from->modify( 'first day of this month' ); //$from->sub( new \DateInterval( 'P5D' ) ); var_dump($from);
Output for 7.1.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2014-10-01 13:12:25.004104" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.28, 7.0.14
object(DateTime)#2 (3) { ["date"]=> string(26) "2014-10-01 13:12:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 7.0.6
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-01 06:55:13.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 7.0.5
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 19:59:28.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 7.0.4
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 05:57:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 7.0.3
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 06:20:22.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 7.0.2
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 16:46:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 7.0.1
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 17:23:11.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 7.0.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 19:08:36.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for hhvm-3.12.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 16:00:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for hhvm-3.10.0
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 03:34:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.21
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-01 02:10:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.20
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 15:16:03.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.19
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 06:02:40.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.18
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 19:00:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.17
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 10:43:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.16
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 20:54:24.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.15
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 21:47:10.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.14
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 00:17:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.13
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 04:19:37.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.12
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 17:48:45.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.11
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 00:43:54.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.10
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 02:36:56.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.9
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 07:37:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.8
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 15:28:44.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.6.7
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-01 05:38:52.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.35
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-01 05:46:53.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.34
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 21:13:09.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.33
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 16:53:13.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.32
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 22:50:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.31
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 13:33:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.30
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-03-01 23:48:25.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.29
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 18:25:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.28
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 20:51:13.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.27
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 23:09:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.26
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 05:00:43.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.25
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-04-01 10:58:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.5.24
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-05-01 17:56:58.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.45
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-09-01 11:31:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.44
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-08-01 04:38:12.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.43
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-08-01 04:38:08.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.42
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-08-01 04:38:07.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.41
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-08-01 04:38:05.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.39 - 5.4.40
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-08-01 04:38:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.38
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-01 16:22:58.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.36 - 5.4.37
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-01 16:22:50.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.34 - 5.4.35
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-03-01 16:22:49.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.30 - 5.4.32
object(DateTime)#2 (3) { ["date"]=> string(26) "2014-10-01 13:12:30.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.18 - 5.4.29
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-10-01 13:12:30" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.3.29 - 5.4.17
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-10-01 13:12:31" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.3.9 - 5.3.28
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-10-01 13:12:32" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.3.0 - 5.3.8
object(DateTime)#2 (3) { ["date"]=> string(19) "2014-10-01 13:12:33" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.2.13 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 4 Warning: DateTime::modify(): Failed to parse time string (first day of this month) at position 10 (o): The timezone could not be found in the database in /in/ofAJS on line 5 object(DateTime)#2 (0) { }
Output for 5.2.0 - 5.2.12
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 4 object(DateTime)#2 (0) { }
Output for 5.0.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 4 Fatal error: Class 'DateTimeZone' not found in /in/ofAJS on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 4 Fatal error: Cannot instantiate non-existent class: datetimezone in /in/ofAJS on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/ofAJS on line 4 Fatal error: Cannot instantiate non-existent class: datetimezone in /in/ofAJS on line 2