loading...
Cover image for daysuntil.org

daysuntil.org

azettl profile image Andreas ・1 min read

I created a small website to tell you how many days passed since a certain date or how many days ahead a date is.

You can find it here https://daysuntil.org

The logic behind it is pretty simple to calculate the days between two dates all you need to do is:

  $today = time();
  $cdate = strtotime('1987/12/27 23:59');
  $difference = $cdate - $today;
  $daysuntil = abs(floor($difference/60/60/24));

  echo $daysuntil;

Get both dates as timestamp, subtract today's timestamp from the one to check, and then divide by 60 to get the minutes, then again by 60 to get the hours and then by 24 to get the days.

To check a specific date just change the URL to https://daysuntil.org/YYYY/MM/DD, for example, Christmas this year https://daysuntil.org/2020/12/25.

Or link to these days with a custom text, for example,
https://daysuntil.org/1987/12/27/event/My%20Birth.

All date calculations are done in the Europe/Berlin timezone.

Discussion

markdown guide