Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2006
    Posts
    11

    Unanswered: CURRENT_TIMESTAMP - 5 minutes

    hi,

    I want to use CURRENT_TIMESTAMP - 5 minutes in a select and where clause.

    I have tried using

    CURRENT_TIMESTAMP - 0.004 AS [Time_-6]

    But this is not a round off to a whole minute

    Also tried

    CURRENT_TIMESTAMP, dateadd(minute, datediff(minute, 0, CURRENT_TIMESTAMP) / 5 * 5, 0)

    But this will not do wholes seconds e.g

    CURRENT_TIMESTAMP = 10.03.33

    CURRENT_TIMESTAMP, dateadd(minute, datediff(minute, 0, CURRENT_TIMESTAMP) / 5 * 5, 0) = 10.00.00

    Can anyone help??

  2. #2
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    What you want is this, if I understand you correctly:

    select dateadd(minute, -5, CURRENT_TIMESTAMP)

  3. #3
    Join Date
    Sep 2006
    Posts
    11
    jezemine thanks for the help. worked first time.

    your a star

Posting Permissions

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