Date Functions
Function | Description | Examples |
|---|---|---|
ADD_MONTHS | Takes the date and adds n months. The result has the same day as input date. If the input date is the last day of the month or has fewer days than the resulting month, then the returning date will be the last day of the month. | June 22nd + 3 = September 22nd |
ROUND | Rounds the date to the unit format that you specify: Minute, Hour, Day, Month, Quarter, Year. | If you specify Month, the function rounds up on the 16th day of the month |
SYSDATE | Returns the current date and time for the system on which the database resides. | 06-13-2012 09:34:41 (displayed in the format: MM-DD-YYYY HH:MM:SS) |
TO_CHAR | Converts a date or interval value to a character data type in the specified format: Date, Timestamp. | finish_Date, 'DD-MON-YYYY HH24:' startDate, 'YYYY-MM-DD HH24:MI:SS' |
TRUNC | Truncates the time portion of a day to the specified format unit: Minute, Hour, Day, Month, Quarter, Year. In Oracle, date values contain a year, month, and day and also the hour, minute, and second. | 10-July-2012 09:34:41 becomes 10-July-2012 |