ROUND (Date)
Returns date rounded to the unit specified by the format model fmt
. The value returned is of type DATE
. If you do not specify fmt
, then date
is rounded to the nearest day.
SQL syntax
ROUND (Date
[,Fmt
])
Parameters
ROUND (
Date
)
has the parameters:
Parameter | Description |
---|---|
|
The date that is rounded. Must resolve to a date value. If you do not specify |
|
The format model rounding unit. Specify either a constant or a parameter for |
Description
-
Date can be of type
DATE
orTIMESTAMP
. The data type returned isDATE
. -
Data types
TT_DATE
andTT_TIMESTAMP
are not supported. -
For the supported format models to use in
fmt
, see "Format Model for ROUND and TRUNC Date Functions".
Examples
Round Date
to the first day of the following year by specifying 'YEAR'
as the format model:
Command> SELECT ROUND (DATE '2007-08-25','YEAR') FROM dual; < 2008-01-01 00:00:00 > 1 row found.
Omit Fmt
. Specify Date
as type TIMESTAMP
with a time of 13:00:00
. Date
is rounded to nearest day:
Command> SELECT ROUND (TIMESTAMP '2007-08-16 13:00:00') FROM dual; < 2007-08-17 00:00:00 > 1 row found.