unrelenting Posted March 19, 2009 Share Posted March 19, 2009 I want to post a "time left" clock deal that gets refreshed with each page refresh but am uncertain how it's done. If I have to unix timestamps, one representing now and one for a date in the future, how could I get it to subract the 2 and print out like this: 3 days 6 hours 14 minutes 12 seconds until the deadline I know it should likely start like: $timeleft = $futuretime - time(); But from there I am lost. Link to comment https://forums.phpfreaks.com/topic/150089-how-to-countdown-using-2-timestamps/ Share on other sites More sharing options...
hellonoko Posted March 19, 2009 Share Posted March 19, 2009 Well you will want to set the format you return the time(); in before you compare them. It depends on if your comparing unix time stamps or dates and times you put in. In your format. There are a lot of usefull functions for time in php. Take a search for 'php time.' This link look like it has some info also: http://www.ozzu.com/programming-forum/compare-time-with-php-t69163.html Link to comment https://forums.phpfreaks.com/topic/150089-how-to-countdown-using-2-timestamps/#findComment-788203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.