Date functions in sql

Date functions are used to process data present in the date format. 

Function Description

Adds n months to date.

example: add_months('17-may-99',22)= 17-jul-99


Specifies the date of the last day of  month.

example: last_day('17-may-99') = 31-mqy-99

MONTHS_BETWEEN(d1,d2) Specifies the number of months between two dates, d1 and d2. If d2 is more than d1, it returns negative value.

Returns the date of the first day of week named by char thaat is equal to or later than the date. suppose you want to find wednesday after date 20-DEC--99,then you can call this function as shown in the following example.

next_day('20-DEC-99', 'wed') = 22-dec-99

TRUNC(value,timeunit) Truncate date according to unit of time.
EXTRACT(FMT FROM DATE) Extracts time component from a date expression