Interesting Tech Projects
Posts tagged php
Reversing PHP’s mktime
Jul 6th
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];