Skip to content

Instantly share code, notes, and snippets.

@taterbase
Created July 12, 2012 15:16
Show Gist options
  • Save taterbase/3098785 to your computer and use it in GitHub Desktop.
Save taterbase/3098785 to your computer and use it in GitHub Desktop.
Months and Days hash for javascript Date
/*
USAGE:
var date = new Date();
console.log("Today is a " + Days[date.getDay()] + " during the month of " + Months[date.getMonth()]);
ABBREVIATED:
console.log(Days.abbr[date.getDay()] + ", " + Months.abbr[date.getMonth()]);
*/
var Days = {
0: "Sunday",
1: "Monday",
2: "Tuesday",
3: "Wednesday",
4: "Thursday",
5: "Friday",
6: "Saturday",
abbr: {
0: "Sun",
1: "Mon",
2: "Tue",
3: "Wed",
4: "Thu",
5: "Fri",
6: "Sat"
}
};
var Months = {
0: "January",
1: "February",
2: "March",
3: "April",
4: "May",
5: "June",
6: "July",
7: "August",
8: "September",
9: "October",
10: "November",
11: "December",
abbr: {
0: "Jan",
1: "Feb",
2: "Mar",
3: "Apr",
4: "May",
5: "Jun",
6: "Jul",
7: "Aug",
8: "Sept",
9: "Oct",
10: "Nov",
11: "Dec"
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment