TRUNC (for dates and time) |
When you specify a date and time value as an argument, the TRUNC function returns the date and time value truncated to a specified date format. When you do not specify a format, the date and time value is truncated to the nearest day.
Return Value
DATETIME
Syntax
TRUNC (datetime_exp, fmt)
Arguments
An expression that identifies a date and time number.
A text expression that specifies one of the format models shown in Table: Format Models for TRUNC for Dates and Time. A format model indicates how the date and time number should be truncated.
Format Models for TRUNC for Dates and Time
| Format Model | Description |
|---|---|
| CC
SCC |
One greater than the first two digits of a 4-digit year to indicate the next century. For example, 1900 becomes 2000. S prefixes BC dates with -.
|
| D
DAY DY |
Starting day of the week (1 to 7). The day of the week that is number 1 is controlled by NLS_TERRITORY (See NLS Options). |
| DD | Day of month |
Examples