PHP: Converting to epoch time and human readable 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;

Convert Epoch Time to Human Readable Time

$human_date=date("Y-m-d", 1251627495);
print human_date;