26.03.2011, 23:55
@Nero_3D:
Yes, both of your functions are a lot faster.
@[FeK]DraKiNs:
Here's my version of GetWeekOfDate:
EDIT: Seems like I misunderstood your function. My functions gets the week index from a year (1 to 52) using a date and yours gives the index of the day. Please name your functions better...
Yes, both of your functions are a lot faster.

@[FeK]DraKiNs:
Here's my version of GetWeekOfDate:
pawn Код:
stock GetWeekOfDate(day, month, year)
{
if((0 < day <= 31) && (0 < month <= 12))
{
new
days_In_Month[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
total_Days
;
for(new i; i < month - 1; ++i)
{
total_Days += days_In_Month[i];
}
return (total_Days + ((((!(year % 4) && (year % 100) != 0)) || !(year % 400)) ? (1) : (0)) + day) / 7;
}
return -1;
}