SA-MP Forums Archive
Need_Help_Function!gettime();getdate(); - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need_Help_Function!gettime();getdate(); (/showthread.php?tid=251685)



Need_Help_Function!gettime();getdate(); - jame42 - 28.04.2011

new Hour, Minute, Second;
gettime(Hour, Minute, Second);
printf("%02d:%02d:%02d", Hour, Minute, Second);

new SecondsA = gettime();
printf("Seconds since midnight 1st January 1970: %d", SecondsA);
how_to_convert_SecondsA_to_Hour,Minute,Second?



new Year, Month, Day;
getdate(Year, Month, Day);
printf("%02d/%02d/%d", Day, Month, Year);

new DaysA = getdate();
printf("Days since the start of the year: %d", DaysA);
how_to_convert_DaysA_to_Month,Day?


Re: Need_Help_Function!gettime();getdate(); - Kwarde - 28.04.2011

pawn Код:
new date[3], time[3];
gettime(time[0], time[1], time[2]);
getdate(date[0], date[1], date[2]);
printf("Date + Time: %02d-%02d-%04d %02d:%02d:%02d", date[2], date[1], date[0], time[0], time[1], time[2]);
dd-mm-yyyy hh:mm:ss format


Re: Need_Help_Function!gettime();getdate(); - jame42 - 28.04.2011

how_to_convert_DaysA_to_Month,Day!(LookUP)


Re: Need_Help_Function!gettime();getdate(); - Vince - 28.04.2011

What's the point when you already have a function to get the time and date? If you want to save on variables, then I'll have to dissapoint you, as writing a whole new function for it would require more variables and more processing time.


Re: Need_Help_Function!gettime();getdate(); - Kwarde - 28.04.2011

If you want those days and month, use the f*cking parameters!
https://sampwiki.blast.hk/wiki/Getdate
I can see you looked on wiki:
Quote:

new Days = getdate();
printf("Days since the start of the year: %d", Days);

But did you for godsake took a look above it?
Quote:

new Year, Month, Day;
getdate(Year, Month, Day);
printf("%02d/%02d/%d", Day, Month, Year);

Use that then!