Oracle SQL - Date Time Value ROUND and TRUNC

Introduction

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, SCCCentury, 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

Demo

SQL>
SQL> select TRUNC(SYSDATE,'DD')
  2  from   dual;

TRUNC(SYS-- from   w w  w .jav  a 2  s.  com
---------
14-APR-18

SQL>

Related Topic