PHP: How to convert epoch time to human time and human time to epoch time
Posted On February 7, 2025
Epoch time is Unix timestamp which counts the number of seconds since January 1 1970 00:00:00 UTC. It is an integer number that represents a date and time. See example:
1355288400
is epoch time for Dec. 12, 2012 midnight.
To convert human readable date and epoch time, use strtotime() function as follows:
<?php
print strtotime('2010-04-25');
print $now;
?>
Convert Epoch Time to Human Readable Time
<?php
$human_date=date("Y-m-d", 1251627495);
print human_date;
?>