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

<?php
  $now = strtotime('2010-04-25');
  print $now;
?>

Convert Epoch Time to Human Readable Time

<?php
  $human_date=date("Y-m-d", 1251627495);
  print human_date;
?>
Technologies: