Re: Calendar ?

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Tue, 29 Jul 2003 13:16:47 -0400, Wolf <wolfritz at KING.IGS.NET>
wrote:

>Given a date:, ie:
>July 29, 2003...
>is there a simple way to calculate the day of the week: ie:
>  ...it's Tuesday !
>
Try this, though I have suspicions it won't work for 2000 and before:
---- Tomohiko Sakamoto=20
constant t=3D{ 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4 }
function dow(integer d, integer m, integer y)
integer k
	y -=3D m < 3
	k=3Dfloor(y/100)
	return remainder(y+floor((y+k)/4)-k+t[m]+d,7)
end function

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu