akshay Posted July 19, 2010 Share Posted July 19, 2010 Hi. Is there any function in mySQL that returns value in seconds elapsed since January 1 1970 00:00:00 GMT, just like time() function in PHP? I've to select * from database where expiry (in seconds) - <...> is less than so many seconds... [note: where <...> is used to represent the function like time() (php) ] Please help. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/208165-mysql-function-like-time/ Share on other sites More sharing options...
PravinS Posted July 19, 2010 Share Posted July 19, 2010 Try this UNIX_TIMESTAMP(NOW()); Quote Link to comment https://forums.phpfreaks.com/topic/208165-mysql-function-like-time/#findComment-1088085 Share on other sites More sharing options...
akshay Posted July 19, 2010 Author Share Posted July 19, 2010 Yea it works! Thanks a lot! Quote Link to comment https://forums.phpfreaks.com/topic/208165-mysql-function-like-time/#findComment-1088088 Share on other sites More sharing options...
PFMaBiSmAd Posted July 19, 2010 Share Posted July 19, 2010 An even faster version - UNIX_TIMESTAMP(); Quote Link to comment https://forums.phpfreaks.com/topic/208165-mysql-function-like-time/#findComment-1088156 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.