Converting to and from epoch time

Epoch time is Unix timestamp which counts the number of seconds since January 1 1970 00:00:00 UTC. Without getting into long discussion, follow is how your convert between human readable date and epoch time.

Convert Human Readable Date to Epoch Time

$now = strtotime('2010-04-25');
print $now;    // 1272175200

Convert Epoch Time to Human Readable Time

$human_date = "";
$human_date=date("Y-m-d", 1251627495);
print $human_date;    // 2009-08-30
print "\n";
$iso8601 = "";
// time() returns current epoch time
$iso8601 = date("c", time());
print $iso8601;     // 2011-01-05T12:22:00-07:00

For more information refer to date and strtotime PHP manuals.