Re:Doomsday rule: calculate the day for any date
by ColinWright on Sunday August 10, 2014 @03:22PM
(#8160447)
> no idea how to work spacing on comments here
* Blank lines create new paragraphs, Blank line followed by lines with
leading spaces create pre-formatted
text - intended for inserting code.
Under most circumstances, asterisks around text creates italics, the exception is when the asterisk is surrounded by space.
Re:Doomsday rule: calculate the day for any date
by hashmymustache on Sunday August 10, 2014 @08:55PM
(#8161380)
ah, thank you
Re:Doomsday rule: calculate the day for any date
by elwell on Sunday August 10, 2014 @04:03PM
(#8160572)
calculateDay = (year, month, day) ->
y = (year - 2000) % 28
m = [6,2,2,5,0,3,5,1,4,6,2,4][month]
m-- if month < 2 and y % 4 is 0
y += (y / 4) | 0
['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][(y + m + day) % 7]
calculateDay = (year,month,day) ->
--- For years 1600s through current century here's a jsfiddle with a slightly longer method with verification: http://jsfiddle.net/9zp0zkxz/Edit: no idea how to work spacing on comments here