Skip to content

Instantly share code, notes, and snippets.

@webdood
Created May 18, 2010 21:02
Show Gist options
  • Save webdood/405545 to your computer and use it in GitHub Desktop.
Save webdood/405545 to your computer and use it in GitHub Desktop.
var day_by_date = function(y, m, d){
return (d+=m<3?y--:y-2,Math.floor(23*m/9)+d+4+Math.floor(y/4)-Math.floor(y/100)+Math.floor(y/400))%7;
};
['sun','mon','tue','wed','thu','fri','sat'][day_by_date(1987, 9, 10)]
from clindsey
@webdood
Copy link
Author

webdood commented May 18, 2010

Figures out the day of the week without using a Date object. Not sure why this is useful, but it's cool that it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment