Simple Day Countdown Script

This little snippit of code is purposely as small as possible. I used it right in a sentence telling how much time was left before an event. Instead of defining a whole function in the header, or some other more complicated way, this was easy to stick right in-line with surrounding text.

Another advantage is that the date you insert is in plain English - such as "Month date, Year". Try it out below:

Date Text String:



Code:
Math.round((Date.parse("May 20, 2018")-new Date().getTime())/86400000);



This work is licensed under a Creative Commons 3.0
Attribution-Noncommercial-Share Alike License
Creative Commons License