Thread: 24 hour time

    #1
  1. PHPer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    La La Land
    Posts
    145
    Rep Power
    13

    24 hour time


    Does it make more sense to set 12 AM to 24:00 or to 00:00? Which will cause less trouble for inserting and reading from a database?
    if (!$broke) {
    dontFixIt();
    }
  2. #2
  3. Web Developer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Location
    Pennsylvania
    Posts
    171
    Rep Power
    0
    To me, it seems more logical to set midnight to 00:00 because it is the switch from PM to AM, thus starting a new day. All digital wrist-watches and clocks that I have ever seen also go from 23:59 to 00:00.

    As far as more efficiency in databases, I really don't know.
  4. #3
  5. PHPer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2002
    Location
    La La Land
    Posts
    145
    Rep Power
    13
    Hmm. It seems that the database will accept 24:00:00, but will not properly use comparison operaters in the SQL queries (eg.: "SELECT * FROM TableName WHERE Time < '24:00:00'" will not work)

    I've seem to come up with a bit of a work around though. Thanks for the suggestion
  6. #4
  7. Doggie
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2003
    Location
    Seattle, WA
    Posts
    751
    Rep Power
    13
    Proper military time has 00:00 as midnight, so if you're using SQL tools to do the comparison, that's how you should store it.

IMN logo majestic logo threadwatch logo seochat tools logo