Rounding dates
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Rounding dates

  1. #1

    Question Rounding dates

    Any recommendations on how one might round a date to the nearest 10-minute interval?

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Two of the possibilities:

    SELECT TRUNC(sysdate) + ROUND(((sysdate-TRUNC(sysdate))*24*60)/10)*10/(24*60)
    FROM dual;

    SELECT TRUNC(sysdate) + 10*ROUND(TO_NUMBER(TO_CHAR(sysdate,'SSSSS'))/60/10)/(24*60)
    FROM dual;
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

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



Click Here to Expand Forum to Full Width