HCProfessionals Posted February 27, 2011 Share Posted February 27, 2011 I would like to have this done in php but am about to lose my mind. Just need a script to countdown to midnight, server time. Doesn't have to be live, just something to see when the page is reloaded. Any help would be much aprreciated Link to comment https://forums.phpfreaks.com/topic/228985-countdown-to-midnight/ Share on other sites More sharing options...
Fergal Andrews Posted February 27, 2011 Share Posted February 27, 2011 Hi HCProfessionals, This will give you the time difference in minutes. Note that midnight date is 28, not 27 which is today's date as it is midnight tomorrow morning (if that makes sense!). <?php $currentTime = date("Y-m-d h:i:s"); $midnight = strtotime("2011-02-28 00:00:00"); $now = strtotime($currentTime); echo round (abs ($midnight - $now) / 60,2)." minutes"; ?> Cheers, Fergal Link to comment https://forums.phpfreaks.com/topic/228985-countdown-to-midnight/#findComment-1180251 Share on other sites More sharing options...
RussellReal Posted February 27, 2011 Share Posted February 27, 2011 if you want this INTERACTIVE you'd need to incorporate some javascript Link to comment https://forums.phpfreaks.com/topic/228985-countdown-to-midnight/#findComment-1180252 Share on other sites More sharing options...
HCProfessionals Posted February 27, 2011 Author Share Posted February 27, 2011 You guys are amazing Link to comment https://forums.phpfreaks.com/topic/228985-countdown-to-midnight/#findComment-1180504 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.