UNIX_TIMESTAMP

UNIX_TIMESTAMP

UNIX_TIMESTAMP()
In PHP we can get use time() function for getting unix timestamp. In mysql we can use unix_timestamp function for the same.If we pass an out-of-range date to UNIX_TIMESTAMP(), it returns 0.Without arguments does return the unix timestamp for the current time.

Syntax:
UNIX_TIMESTAMP([timestamp]);

Example :

SELECT UNIX_TIMESTAMP();

UNIX_TIMESTAMP(’2004-10-31 01:52:37′);

Output :

1170925939

1099167757

Leave a Reply

You must be logged in to post a comment.


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.