EchoFool Posted January 20, 2009 Share Posted January 20, 2009 I am trying to make a field in my query to hold how many seconds have passed from a date in my table but it keeps returning total number of days passed so i get a return of 0. What function should i actually be using ? This is what i tried: <?php $GetDate = mysql_query("SELECT DATEDIFF(NOW(), Date) AS SecondsPassed FROM users WHERE UserID='{$_SESSION['Current_User']}'") or die(mysql_error()); ?> Hope you can help me. Link to comment https://forums.phpfreaks.com/topic/141629-solved-how-many-seconds-passed/ Share on other sites More sharing options...
rhodesa Posted January 20, 2009 Share Posted January 20, 2009 try: <?php $GetDate = mysql_query("SELECT TIME_TO_SEC(TIMEDIFF(NOW(), `Date`)) AS SecondsPassed FROM users WHERE UserID='{$_SESSION['Current_User']}'") or die(mysql_error()); ?> Link to comment https://forums.phpfreaks.com/topic/141629-solved-how-many-seconds-passed/#findComment-741352 Share on other sites More sharing options...
EchoFool Posted January 20, 2009 Author Share Posted January 20, 2009 Thanks worked a treat. Link to comment https://forums.phpfreaks.com/topic/141629-solved-how-many-seconds-passed/#findComment-741632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.