EchoFool Posted May 12, 2010 Share Posted May 12, 2010 Hey in my SQL i currently use: DATEDIFF(NOW(),RegisterDate) AS DaysOld This returns days that have passed from the yyyy-mm-dd HH:mm:ss But is there a way to change it to how many seconds have past instead of days? I saw theres a microsecond function on here http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html but i don't know the correct syntax to apply it for seconds. Hope you can help. Quote Link to comment https://forums.phpfreaks.com/topic/201524-seconddiff-compared-to-now/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 12, 2010 Share Posted May 12, 2010 http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_timestampdiff Quote Link to comment https://forums.phpfreaks.com/topic/201524-seconddiff-compared-to-now/#findComment-1057280 Share on other sites More sharing options...
EchoFool Posted May 12, 2010 Author Share Posted May 12, 2010 So : mysql> SELECT SELECT(NOW()RegisterDate) ? Quote Link to comment https://forums.phpfreaks.com/topic/201524-seconddiff-compared-to-now/#findComment-1057281 Share on other sites More sharing options...
EchoFool Posted May 12, 2010 Author Share Posted May 12, 2010 I got this : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'User1Time) AS User1Passed,SECOND(NOW()User2Time) AS User2Passed FROM' at line 1 SQL: SELECT *,SECOND(NOW(),User1Time) AS User1Passed,SECOND(NOW(),User2Time) AS User2Passed FROM tablename() Quote Link to comment https://forums.phpfreaks.com/topic/201524-seconddiff-compared-to-now/#findComment-1057426 Share on other sites More sharing options...
PFMaBiSmAd Posted May 12, 2010 Share Posted May 12, 2010 Since that is not the correct syntax for either the SECOND() function (which won't do what you want) or the TIMESTAMPDIFF() function (which will do what you want), you are going to need to do what the error message suggests - check the manual that corresponds to your MySQL server version for the right syntax to use Quote Link to comment https://forums.phpfreaks.com/topic/201524-seconddiff-compared-to-now/#findComment-1057428 Share on other sites More sharing options...
EchoFool Posted May 12, 2010 Author Share Posted May 12, 2010 lol k - never mind i got the answer i need on another forum almost straight away. Quote Link to comment https://forums.phpfreaks.com/topic/201524-seconddiff-compared-to-now/#findComment-1057450 Share on other sites More sharing options...
PFMaBiSmAd Posted May 13, 2010 Share Posted May 13, 2010 You were linked to a solution in the first reply in the thread, 34 minutes after you started it. It does not look like you read it because your two follow on posts were devoid of any hint of actual sql. Quote Link to comment https://forums.phpfreaks.com/topic/201524-seconddiff-compared-to-now/#findComment-1057671 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.