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/0dd5b7c20ba880c08139 to your computer and use it in GitHub Desktop.
Save le717/0dd5b7c20ba880c08139 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() {
"use strict";
var curDate = new Date(),
curYear = curDate.getUTCFullYear();
var futureYear = curYear + 1,
futureMonth = 1, // UTC month value is zero-based
futureDay = 12;
// Format the date in a more readable form
var options = {
day : "numeric",
year : "numeric",
month : "long",
weekday: "long"
};
var bridalExpo = new Date(futureYear, futureMonth, futureDay),
daysToGo = bridalExpo.getTime() - curDate.getTime(),
daysToBridalExpo = Math.ceil(daysToGo / (1000 * 60 * 60 * 24));
var message = "Today is " + curDate.toLocaleString("en-US", options) + ". ";
message += "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