Unix timestamp to date/time 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: Unix timestamp to date/time function? (
/showthread.php?tid=315143)
Unix timestamp to date/time function? -
Whizion - 01.02.2012
I searched and searched but i just couldn't find the function i need.
I would need something that would transform a unix timestamp like this:
Timestamp: 1328163742
Into this: 02/02/12 @ 00:22:22
Please help me, thank you.
Re: Unix timestamp to date/time function? -
MP2 - 01.02.2012
gettime().
Re: Unix timestamp to date/time function? -
Basssiiie - 01.02.2012
Just use gettime() and getdate()
with parameters. (Search the Wiki for more info)
Re: Unix timestamp to date/time function? -
Vince - 01.02.2012
If you're fetching the timestamp from MySQL along with other data, then you might consider doing something like:
PHP код:
SELECT *, FROM_UNIXTIME(`timestamp`) AS `frm_timestamp` FROM `table` WHERE `something` = 1
You can also specify a custom format. Read up on it in the documentation.
Re : Unix timestamp to date/time function? -
human-product - 03.02.2012
I have prepared this little code because I had found one but the timestamp was not right.
When I used the wiki to SA-MP that does not take me more than 5 minutes to understand:
https://sampwiki.blast.hk/wiki/Gettime
Thank you for having me on the track reopened if not I would not change my code!
Код:
forward timestamp();
public timestamp()
{
new time = gettime();
return time;
}
See you soon!