Day/Month. - 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: Day/Month. (
/showthread.php?tid=346850)
Day/Month. -
iGetty - 30.05.2012
How do I get the day/month that we're currently in? (In real life)
Re: Day/Month. -
Vince - 30.05.2012
getdate(). You can't find out the day of the week (Monday, Tuesday, etc) though. At least you can't without some sophisticated coding. A mysql server can calculate the day of the week, as well as the CTime library (read that somewhere).
Re: Day/Month. -
iGetty - 30.05.2012
I use MySQL, but I really don't understand how to get the day and month.
I just read up about the GetDate function, I could possible try make a stock for the month thing, but the day thing, maybe difficult.
Although, I could start on today, EG:
if(day == 30) format(string, sizeof(string), "Wednesday");
Could that work? Thanks!
Re: Day/Month. -
iGetty - 30.05.2012
Aye. Thanks ******.
Re: Day/Month. -
Calgon - 30.05.2012
Fortunately, I found this after searching:
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;
}
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.
Re: Day/Month. -
iGetty - 30.05.2012
Thank you Calgon!
Are you on MSN matey?