The following table lists the date formats (fmt) supported by the date functions ROUND and TRUNC.
The default format is 'DD', resulting in rounding or truncating to midnight.
For example, TRUNC(SYSDATE,'DD') truncates the current system date and time to midnight.
Format | Description |
---|---|
CC, SCC | Century, with or without minus sign (BC) |
[S]YYYY, [S]YEAR, YYY, YY, Y | Year (in various appearances) |
IYYY, IYY, IY, I | ISO year |
Q | Quarter |
MONTH, MON, MM, RM | Month (full name, abbreviated name, numeric, Roman numerals) |
IW, WW | (ISO) week number |
W | Day of the week |
DDD, DD, J | Day (of the year/of the month/Julian day) |
DAY, DY, D | Closest Sunday |
HH, HH12, HH24 | Hours |
MI | Minutes |
SQL> SQL> select TRUNC(SYSDATE,'DD') 2 from dual; TRUNC(SYS-- w w w .j av a2 s . c o m --------- 14-APR-18 SQL>