3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php print_r(verifyDate('1.1.2011')); echo ':::'; print_r(verifyDate(2015)); echo ':::'; print_r(getMonth(null)); echo ':::'; print_r(getQuarter(null)); echo ':::'; print_r(dtf(' ')); function getMonth($d) { return dtf($d,'n'); } function getQuarter($d) { return ceil( getMonth($d) / 3); } function verifyDate($date) { return DateTime::createFromFormat('d.m.Y', $date); } function dtf($date, $format = 'd.m.Y'){ if($date){ $date = new DateTime($date); return $date->format($format); } }
based on jn6ev
Output for 5.5.14 - 5.6.38, hhvm-3.10.1 - 3.12.14, hhvm-3.15.4 - 3.21.0, 7.0.0 - 7.3.0
DateTime Object ( [date] => 2011-01-01 13:55:30.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for hhvm-3.13.2, hhvm-3.21.3 - 3.22.0
DateTime Object ( [date] => 2011-01-01 13:55:31.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.5.0 - 5.5.13
DateTime Object ( [date] => 2011-01-01 13:55:30 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.45
DateTime Object ( [date] => 2011-01-01 13:55:33.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.44
DateTime Object ( [date] => 2011-01-01 13:55:34.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.43
DateTime Object ( [date] => 2011-01-01 13:55:35.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.41 - 5.4.42
DateTime Object ( [date] => 2011-01-01 13:55:36.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.40
DateTime Object ( [date] => 2011-01-01 13:55:37.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.38 - 5.4.39
DateTime Object ( [date] => 2011-01-01 13:55:38.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.37
DateTime Object ( [date] => 2011-01-01 13:55:39.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.35 - 5.4.36
DateTime Object ( [date] => 2011-01-01 13:55:40.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.34
DateTime Object ( [date] => 2011-01-01 13:55:41.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.32
DateTime Object ( [date] => 2011-01-01 13:55:42.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.30 - 5.4.31
DateTime Object ( [date] => 2011-01-01 13:55:43.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.29
DateTime Object ( [date] => 2011-01-01 13:55:43 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.26 - 5.4.28
DateTime Object ( [date] => 2011-01-01 13:55:44 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.25
DateTime Object ( [date] => 2011-01-01 13:55:45 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.28, 5.4.23 - 5.4.24
DateTime Object ( [date] => 2011-01-01 13:55:46 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.19 - 5.4.22
DateTime Object ( [date] => 2011-01-01 13:55:47 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.4.18
DateTime Object ( [date] => 2011-01-01 13:55:48 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.27, 5.4.16 - 5.4.17
DateTime Object ( [date] => 2011-01-01 13:55:49 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.24 - 5.3.26, 5.4.14 - 5.4.15
DateTime Object ( [date] => 2011-01-01 13:55:50 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.21 - 5.3.23, 5.4.12 - 5.4.13
DateTime Object ( [date] => 2011-01-01 13:55:51 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.20, 5.4.10 - 5.4.11
DateTime Object ( [date] => 2011-01-01 13:55:52 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015
Output for 5.3.29
DateTime Object ( [date] => 2011-01-01 13:55:42 [timezone_type] => 3 [timezone] => Europe/Amsterdam ) :::::::::0:::30.11.2015