GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2009-05-19 22:24:38

blopit
Member
Registered: 2009-05-19
Posts: 7

get_weekday(day,month,year)

Expand/*
get_weekday(day,month,year)

arguments:
    day
    month
    year

returns: 
    the weekday on the date indicated
    0=sunday
    1=monday
    2=tuesday

*/

yy=argument2 mod 100
c=((argument2-(argument2 mod 100))/100)
m= argument1+10 
if m>12 =false {yy-=1}else{m-=12}
return (floor(argument0+((13*m-1)/5))+yy+floor(yy/4)+floor(c/4)-(2*c))mod 7

made this while checking zeller's laws

Offline

#2 2009-05-20 01:46:38

xot
Administrator
Registered: 2007-08-18
Posts: 1,240

Re: get_weekday(day,month,year)

Interesting but Game Maker already has this functionality.

Expanddate_get_weekday(date_create_date(year,month,day));

What are "zeller's laws"?


Abusing forum power since 1986.

Offline

#3 2009-05-20 17:58:05

blopit
Member
Registered: 2009-05-19
Posts: 7

Re: get_weekday(day,month,year)

Woops I completely missed that one. I honestly don't even remember that command.

and for zeller's laws
http://en.wikipedia.org/wiki/Zeller's_congruence
the 'laws' are the rules you have to follow to find the correct weekday.

Last edited by blopit (2009-05-20 18:03:32)

Offline

Board footer

Powered by FluxBB