Any recommendations on how one might round a date to the nearest 10-minute interval?
Printable View
Any recommendations on how one might round a date to the nearest 10-minute interval?
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;