Interesting Tech Projects
Reversing PHP’s mktime
mktime takes a set of six integers and creates a UNIX timestamp. Surely there is a better way of reversing it than this?
$timestring = date("Y-m-d H:i:s", $time); preg_match('/(\d+)\-(\d+)-(\d+) (\d+):(\d+):(\d+)/', $timestring, $matches); $year = $matches[1]; $month = $matches[2]; $day = $matches[3]; $hour = $matches[4]; $minute = $matches[5]; $second = $matches[6];
Print article | This entry was posted by Andy on July 6, 2012 at 2:24 am, and is filed under Software Engineering. Follow any responses to this post through RSS 2.0. Both comments and pings are currently closed. |
Comments are closed.