30.05.2012, 11:49
Fortunately, I found this after searching:
It seemed to work when I tested (though the test script will return the day for 2 days ago as I subtracted 2 from the day count after getdate()) it.
pawn Код:
// Credit to yom
stock GetWeekDay(day=0, month=0, year=0) {
if(!day)
getdate(year, month, day);
new
szWeekDay[10],
j,
e;
if(month <= 2) {
month += 12;
--year;
}
j = year % 100;
e = year / 100;
switch((day + (month+1)*26/10 + j + j/4 + e/4 - 2*e) % 7) {
case 0: szWeekDay = "Saturday";
case 1: szWeekDay = " Sunday";
case 2: szWeekDay = " Monday";
case 3: szWeekDay = " Tuesday";
case 4: szWeekDay = "Wednesday";
case 5: szWeekDay = "Thursday";
case 6: szWeekDay = " Friday";
}
return szWeekDay;
}