Skip to content

Instantly share code, notes, and snippets.

@le717
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save le717/65733a3e020ab1270594 to your computer and use it in GitHub Desktop.
Save le717/65733a3e020ab1270594 to your computer and use it in GitHub Desktop.
For Adventures in Website Design && Development – 6/26/14 (http://wp.me/p1V5ge-1zi)
function countDown() {
var today = new Date()
var dayOfWeek = today.toLocaleString()
dayLocate = dayOfWeek.indexOf(" ")
weekDay = dayOfWeek.substring(0, dayLocate)
newDay = dayOfWeek.substring(dayLocate)
dateLocate = newDay.indexOf(",")
monthDate = newDay.substring(0, dateLocate+1)
yearLocate = dayOfWeek.indexOf("2014")
year = dayOfWeek.substr(yearLocate, 4)
var bridalExpo = new Date("February 12, 2014")
var daysToGo = bridalExpo.getTime()-today.getTime()
var daysToBridalExpo = Math.ceil(daysToGo/(1000*60*60*24))
var message ="Today is "+weekDay+" "+monthDate+" "+year+". We have "+daysToBridalExpo+" days until the Midwest Bridal Expo."
console.log(message);
}
countDown()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment