SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot Mr Chocolate's Avatar
    Join Date
    May 2002
    Location
    Australia
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    time left format

    Hi,

    I was looking over at the Mysql website trying to find out how i could calculate the difference between 2 timestamps.

    you know when you go to an auction website they have the days hours minutes and seconds left on the auction.

    example : 2 days 14hours 5 min 22 seconds.


    this is what i thought would work.

    date_format((enddate - startdate ) '%e days %H hours %i min %S seconds') as timeleft


    any help would be great! thanks.

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Zealot Mr Chocolate's Avatar
    Join Date
    May 2002
    Location
    Australia
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks arakys,

    but i'm looking for a Mysql way to do it. I'm sure it can be done just using Mysql.

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops, sorry about that. I'm not very familiar with MySQL but it seems that it doesn't support a function similar to DateDiff in VB. The only functions available would be those listed here :

    http://www.mysql.com/doc/en/Date_and...functions.html

  5. #5
    SitePoint Zealot Mr Chocolate's Avatar
    Join Date
    May 2002
    Location
    Australia
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's where i was looking for a solution but i could not find one.

    thanks anyway.

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Humm.. what about using the Date_Add() or Date_Sub() functions ?

    http://www.databasejournal.com/featu...le.php/2190421


Bookmarks

Posting Permissions

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