SA-MP Forums Archive
Timestamp - 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: Timestamp (/showthread.php?tid=405204)



Timestamp - ScriptWriter - 05.01.2013

Hey everyone. How convert timestamp value to date in pawn? I saw include, but i don't know how it uses.
Sorry for bad english.


Re: Timestamp - park4bmx - 05.01.2013

You need to format it this way
pawn Код:
new str[59], Hour, Minute, Second;
gettime(Hour, Minute, Second);
format(str, sizeof str,"%02d:%02d:%02d", Hour, Minute, Second);



Re: Timestamp - ScriptWriter - 05.01.2013

No, i have timestamp value and i want convert it in yy/mm/dd hh:minec.


Re: Timestamp - park4bmx - 05.01.2013

pawn Код:
new str[69],Year, Month, Day;
getdate(Year, Month, Day);
format(str,sizeof str,"%02d/%02d/%d", Day, Month, Year);
Just change them around


Re: Timestamp - Vince - 05.01.2013

A timestamp, as in unix timestamp. That might not be the current time!

It's rather easy to calculate this because you know that the epoch is 01/01/1970 00:00:00. If you give me a minute I'll write a function for it. I might need it as well. Edit: alright, scratch that. It's harder than it looked like. Leap years and shit.


Re: Timestamp - ScriptWriter - 05.01.2013

If you can write this function, i'll really grateful.


Re: Timestamp - ScriptWriter - 06.01.2013

Bump.


Re: Timestamp - park4bmx - 06.01.2013

this is not something you would script in couple of minites/hours

there is a include that might do the same job u want: https://sampforum.blast.hk/showthread.php?tid=347605

and converter function http://pastebin.ca/2064736


Re: Timestamp - Drake1994 - 06.01.2013

http://forum.sa-mp.com/showthread.ph...ighlight=uDate