alohatofu Posted April 19, 2007 Share Posted April 19, 2007 I have 2 dates one is now and the other date I have output as 2007-04-18 02:05:22 2007-04-18 02:05:22 is the first date = $creationDate and $timestamp = time(); when i use $result = $timestamp - $creationDate; it out put time in 1176956379 How can I format them in hours and minutes? Thank you Link to comment https://forums.phpfreaks.com/topic/47687-calculating-time-to-display-hours-and-minutes/ Share on other sites More sharing options...
alohatofu Posted April 19, 2007 Author Share Posted April 19, 2007 can someoen please help? thanks Link to comment https://forums.phpfreaks.com/topic/47687-calculating-time-to-display-hours-and-minutes/#findComment-232911 Share on other sites More sharing options...
JSHINER Posted April 19, 2007 Share Posted April 19, 2007 Try this: date("H:i",strtotime($result)); That should display as 12:50 - (hours:min) Link to comment https://forums.phpfreaks.com/topic/47687-calculating-time-to-display-hours-and-minutes/#findComment-232914 Share on other sites More sharing options...
shaymol Posted April 19, 2007 Share Posted April 19, 2007 Hi mates You can do the following , i am giving you details with printing some text below: <? echo "TimeStamp of 2007-04-18 02:05:22 is : " . strtotime("2007-04-18 02:05:22"); echo "<br>"; echo "Current Time is : " . time(); echo "<br>"; $timeSt = (time() - strtotime("2007-04-18 02:05:22")); echo "<pre>"; echo "After Calculation of those Result in time is :" . date("H:i:s" , $timeSt); ?> Thanks Shaymol Link to comment https://forums.phpfreaks.com/topic/47687-calculating-time-to-display-hours-and-minutes/#findComment-232917 Share on other sites More sharing options...
alohatofu Posted April 19, 2007 Author Share Posted April 19, 2007 Thank you so much! let me try. Link to comment https://forums.phpfreaks.com/topic/47687-calculating-time-to-display-hours-and-minutes/#findComment-232920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.