SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: mySQL Times

  1. #1
    SitePoint Member
    Join Date
    Oct 2011
    Location
    Central London
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mySQL Times

    Hi Guys,

    I have a history file and I would like to sequence it in date time sequnce. However, I need more precision than a second. I have looked at the docs but thought I would float the question out here:

    What is the best way to store dates with micro or milli second precision?

    And, is there a noticeable performance hit when using such a thing?

    Many thanks for any help,

    S

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    my question to you is, where are the times containing microseconds going to be coming from?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Oct 2011
    Location
    Central London
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    my question to you is, where are the times containing microseconds going to be coming from?
    Well, I imagine there can be either a php function or a MySQL routine. I was hoping to be pointed in the right direction.

    Unless, of course, MySQL does not have a data type that can store fractions of seconds. If that is the case, and I wonder if it is, then I will have to put in place another mechanism that allows me to store and then retrieve highly precise chronological data.

    Any assistance much appreciated,

    S

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by eazyGen View Post
    Unless, of course, MySQL does not have a data type that can store fractions of seconds. If that is the case, and I wonder if it is...
    wonder no more


    Quote Originally Posted by da manual
    However, when MySQL stores a value into a column of any temporal data type, it discards any fractional part and does not store it.
    -- http://dev.mysql.com/doc/refman/5.0/...l-seconds.html
    you could use DECIMAL to make your own, i guess

    which leads back to... where are these fractional values going to be coming from?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •