Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/201524-seconddiff-compared-to-now/
Share on other sites

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()

 

:(

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
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.