Sunday, January 25, 2015

DATE FUNCTIONS in SQL

DATE FUNCTIONS :- In order to process and manipulate dates,Oracle provides a number of functions that operate on various date related datatypes in oracle.The default date format in Oracle is DD-MON-YY and default time format is HH:MI:SS.
    The various date  functions are described below.
1-Command :- SYSDATE
Purpose :-  It returns the current date and time of the system.
Example :-
 

2-Command :- ADD_MONTHS(date,n)
Purpose :- It adds or subtracts n number of months to/from a date value.
 Example :-
3-Command :- LAST_DAY
Purpose :- It returns the date of last day of the month.
Example :-

4-Command :- NEXT_DAY
Purpose :- It returns the date value of next named day after given date.
Example :-

5-Cammand :- MONTHS_BETWEEN(date2,date1)
Purpose :- It  determines the number of months between date2 and date1.
Example :-

0 comments:

Post a Comment

Blog Archive