TRUNC (dates) function in Oracle

TRUNC (dates) is one of the vital Date/Time functions of Oracle. It is used to get a date truncated to a specific unit of measure. The TRUNC (dates) function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i and Oracle 8i.

Syntax:

TRUNC ( date, format )

Parameters: date: It is used to specify the date to be truncated. format: It is an optional parameter which is used to specify the unit of measure to be used for truncating.

Example 1:

TRUNC( TO_DATE ('22-AUG-19'),'YEAR')

Output:

'01-JAN-19'

Explanation: The result is the truncated date as per the YEAR format.

Please follow and like us:
Content Protection by DMCA.com