Results 1 to 7 of 7
  1. #1
    Join Date
    Nov 2004
    Posts
    16

    Unanswered: NOW() with milliseconds?

    Is there any function within MySQL that can return the current time with millisecond resolution. NOW() only returns the integer number of seconds...

    Thanks in advance.

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Would this help?
    Last edited by gvee; 08-21-07 at 12:06. Reason: "Would" doesn't have a Q
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2004
    Posts
    16
    i don't think so, it says you can return the milliseconds from an argument but there's nothing related to NOW() or CURTIME() with finer resolution than seconds

    I'm looking at this right now for help.

    http://bugs.mysql.com/bug.php?id=8523

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10

  5. #5
    Join Date
    Nov 2004
    Posts
    16
    not using postgresql or oracle.

    what the best way to compile and use a UDF on a windows platform?

  6. #6
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by The link I posted

    MySQL

    It turns out that MySQL does not support sub-second time or date formats. There is a MICROSECOND function in MySQL allowed to run on temporal values, but sub-second precision (including millisecond) is not stored in the database.
    The message I have entered is too short...
    George
    Home | Blog

  7. #7
    Join Date
    Nov 2004
    Posts
    16
    not sure what the point of your last reply was...

    anyway, I found a method. I created a dll using Visual C++ .NET 2005. I then turned the dll into a UDF...all the UDF did was get the current system time's millisecond value using the C++ SYSTEMTIME structure. I then added this to the number of seconds you can get using the UNIX_TIMESTAMP and NOW() functions in SQL. Store it as a DOUBLE PRECISION and voila you've got a current UTC time with millisecond resolution.

    relevant link:

    http://www.codeguru.com/cpp/data/mfc...p/c12615/#more

Posting Permissions

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