Will this work properly in future? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Will this work properly in future? (
/showthread.php?tid=286963)
Will this work properly in future? -
Jafet_Macario - 01.10.2011
Hey, will this code work properly tommorow, after-tommorow and in the future? (If it will update the correct data)
For today, it outputs: Saturday, October, 2011.
pawn Код:
stock GetDate()
{
new year,month,day, str[128], dtext[50], mtext[50];
getdate(year, month, day);
new j, e;
if (month <= 2)
{
month += 12;
--year;
}
j = year % 100;
e = year / 100;
switch(day)
{
case 0: dtext = "Friday";
case 1: dtext = "Saturday";
case 2: dtext = "Sunday";
case 3: dtext = "Monday";
case 4: dtext = "Tuesday";
case 5: dtext = "Wednesday";
case 6: dtext = "Thursday";
}
switch(month)
{
case 1: mtext = "January";
case 2: mtext = "February";
case 3: mtext = "March";
case 4: mtext = "April";
case 5: mtext = "May";
case 6: mtext = "June";
case 7: mtext = "July";
case 8: mtext = "August";
case 9: mtext = "September";
case 10: mtext = "October";
case 11: mtext = "November";
case 12: mtext = "December";
}
format(str,sizeof(str),"%s, %s, %d", dtext, mtext, year);
return ((day + (month+1)*26/10 + j + j/4 + e/4 - 2*e) % 7), str;
}