Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2007
    Posts
    64

    Thumbs down Unanswered: Time In Milliseconds

    Hi ,

    Is there any function to convert the time in a date to milliseconds .
    If i execute the query 'SELECT current_timestamp' will return date and time in standard format .
    2009-04-21 16:14:55.09

    Is there any date/time function to convert this standard time format to milliseconds.

    Thanks ,
    Sush...

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Code:
    DECLARE @some_datetime datetime
    
    SET @some_datetime = GetDate()
    
    SELECT @some_datetime As some_datetime
         , DateAdd(dd, DateDiff(dd, 0, @some_datetime), 0) As no_time
         , DateDiff(ms, DateAdd(dd, DateDiff(dd, 0, @some_datetime), 0), @some_datetime) As milliseconds
    Any good?
    George
    Home | Blog

  3. #3
    Join Date
    Apr 2009
    Posts
    3

    Reply to sushma007

    hi,
    make a try with a precision value to the selected column (current_timestamp),coz this defaults to 6.
    Cheers,
    Ram.

Posting Permissions

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