Unix timestamp to date/time function?
#1

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

gettime().
Reply
#3

Just use gettime() and getdate() with parameters. (Search the Wiki for more info)
Reply
#4

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_timestampFROM `tableWHERE `something` = 
You can also specify a custom format. Read up on it in the documentation.
Reply
#5

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)