Timestamp
#1

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.
Reply
#2

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);
Reply
#3

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

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
Reply
#5

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.
Reply
#6

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

Bump.
Reply
#8

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
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)