Jump to content

count number of days and total time in hours


anujgarg

Recommended Posts

You can use strtotime on the first format

 

$ts = strtotime('2008-08-12 12:06:00');

 

and then something like this maybe

 

<?php
$ts = '1221650951';
$difference = time() - $ts;
$days = number_format(($difference / 86400), 2);
$hours = number_format(($difference / 3600), 2);
echo "Number of days since ".date('Y-m-d', $ts)." is $days";
echo "<br />";
echo "Number of hours since ".date('Y-m-d', $ts)." is $hours";
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.