This Oracle tutorial explains how to use the Oracle/PLSQL ROUND function (as it applies to date values) with syntax and examples.
The Oracle/PLSQL ROUND function returns a date rounded to a specific unit of measure.
The syntax for the ROUND function in Oracle/PLSQL is:
The date to round.
Optional. The unit of measure to apply for rounding. If the format parameter is omitted, the ROUND function will round to the nearest day. It can be can one of the following values:
Unit | Valid format parameters | Rounding Rule |
---|---|---|
Year | SYYYY, YYYY, YEAR, SYEAR, YYY, YY, Y | Rounds up on July 1st |
ISO Year | IYYY, IY, I | |
Quarter | Q | Rounds up on the 16th day of the second month of the quarter |
Month | MONTH, MON, MM, RM | Rounds up on the 16th day of the month |
Week | WW | Same day of the week as the first day of the year |
IW | IW | Same day of the week as the first day of the ISO year |
W | W | Same day of the week as the first day of the month |
Day | DDD, DD, J | |
Start day of the week | DAY, DY, D | |
Hour | HH, HH12, HH24 | |
Minute | MI |
The ROUND function (as it applies to dates) returns a date value.
The ROUND function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle ROUND function examples and explore how to use the ROUND function in Oracle/PLSQL.
For example: