3v4l.org

run code in 300+ PHP versions simultaneously
<?php $schedule = '31/03/2011 01:22 pm'; // %Y, %m and %d correspond to date()'s Y m and d. // %I corresponds to H, %M to i and %p to a $ugly = strptime($schedule, '%d/%m/%Y %I:%M %p'); $ymd = sprintf( // This is a format string that takes six total decimal // arguments, then left-pads them with zeros to either // 4 or 2 characters, as needed '%04d-%02d-%02d %02d:%02d:%02d', $ugly['tm_year'] + 1900, // This will be "111", so we need to add 1900. $ugly['tm_mon'] + 1, // This will be the month minus one, so we add one. $ugly['tm_mday'], $ugly['tm_hour'], $ugly['tm_min'], $ugly['tm_sec'] ); echo $ymd; $new_schedule = new DateTime($ymd); echo $new_schedule->format('Y-m-d H:i:s'); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Function strptime() is deprecated in /in/GOIBK on line 5 2011-03-31 13:22:002011-03-31 13:22:00

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
27.8 ms | 401 KiB | 8 Q