www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] mysql time remaining

  1. #1
    Join Date
    Oct 2006
    Location
    California, USA
    Posts
    121

    resolved [RESOLVED] mysql time remaining

    Hello,

    I'm trying to calculate the time remaining left on an "auction". This is the code I have:

    Code:
    SELECT DATEDIFF(CURDATE(), endtime) AS timeleft FROM `auctions` WHERE `id` = '".$id."'
    However, it only pulls the days. How can I get it to pull the seconds as well?

  2. #2
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    try TIMEDIF and CURTIME
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

  3. #3
    Join Date
    Oct 2006
    Location
    California, USA
    Posts
    121
    It is returning null.

  4. #4
    Join Date
    Jun 2003
    Location
    here
    Posts
    4,551
    TIMEDIFF() returns expr1 – expr2 expressed as a time value. expr1 and expr2 are time or date-and-time expressions, but both must be of the same type.
    what format is your end date?

    use NOW() for date/time, and CURTIME for time.
    Last edited by scragar; 02-09-2008 at 05:29 PM.
    If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
    The same applies to HTML and the forums [HTML][/HTML] tags.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles