Jump to content

Countdown to midnight


HCProfessionals

Recommended Posts

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

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.