Time and Date function - 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: Time and Date function (
/showthread.php?tid=542835)
Time and Date function -
ShoortyFl - 22.10.2014
So I'm struggling with this, this function is supposed to give me a time and a date and it works but the only problem is seconds/minutes etc..
So if time is 12:01:20 the function will retrun me this 12:1:20 i don't know why is that, if there is 0 before secon it will left it blank, hope you understand what i'm talking about... :P
pawn Код:
stock TimeDate()
{
new
day,
month,
year,
hour,
minute,
second,
string[50];
getdate(year, month, day);
gettime(hour, minute, second);
format(string, sizeof(string), "%d/%d/%d u %d:%d:%d", day, month, year, hour, minute, second);
return string;
}
Re: Time and Date function -
Jefff - 22.10.2014
%02d
Re: Time and Date function -
ShoortyFl - 22.10.2014
Every %d to change to %02d ?
Re: Time and Date function -
Glossy42O - 22.10.2014
Yep.