Oracle ROUND (date)

Function Description

Function ROUND (date) returns the date rounded to the unit specified by the date format model.
If date format model is omited then date will be rounded to the nearest day.

Examples

SELECT ROUND(TO_DATE('30.11.2011'),'MONTH') AS "ROUND DATE" 
  FROM dual;

Result: 1.12.2011

SELECT ROUND(TO_DATE('30.11.2011'),'YEAR') AS "ROUND DATE" 
  FROM dual;

Result: 1.1.2012

SELECT ROUND(TO_DATE('30.11.2011 20:00:00')) AS "ROUND DATE" 
  FROM dual;

Result: 1.1.2012
This entry was posted in Oracle SQL Functions. Bookmark the permalink.