TRUNC (Date usage)#
Functionality: #
This Oracle function will remove a portion of the date, and return a valid date back to you.Also see the numeric usage of the TRUNC function.
Parameters:#
Date/Time | The date that you want truncated |
Format | (optional) An indication of what you want truncated to |
Returns:#
DateErrors:#
NoneOperations: #
All Oracle date format fields are actually a Date/Time stamp with a date portion and a time portion. The application does not normally make use of the Time portion of a date variable and so the time is always defaulted as midnight (00:00:00.00)Without a FORMAT parameter, this will return the date as a date at midnight. It is strongly recommended that you use this function when referencing the SYSDATE construct in relation to EXPIRY and EFFECTIVE dates.
With a FORMAT parameter, it will selectively remove part of the date information:
Examples:#
TRUNC(~) will return the date passed (but with a time stamp of midnight)
TRUNC(~,’MM’) will return the first day of the month
TRUNC(~,’YYYY’) will return the first day of the year