19.09.2011, 23:31
How do you make a function to return the week DAY? By this I mean Monday, Tuesday, Wednesday etc.
stock GetWeek(d,m,y) //by drakins,thanks vine
{
m=(m-=2);
if(m<=0) --y,m+=12;
return ( ((
(d+((13*m-1)/5)+(y%100)+((y%100)/4)+(((y%100)%100)/4)-2*(y%100))%7) == 0)?
(((d+((13*m-1)/5)+(y%100)+((y%100)/4)+(((y%100)%100)/4
)-2*(y%100))%7) + 1) : (((d+((13*m-1)/5)+(y%100)+((y%100)/4)+
(((y%100)%100)/4)-2*(y%100))%7)
) );
}
#define GetWeek() ((getdate() % 0x7) + 0x6) |
This should do the trick.
pawn Code:
He meant to return the weekday such as Monday, Tuesday, Wednesday. |