Logo 
Search:

Oracle Articles

Submit Article
Home » Articles » Oracle » Date Time FunctionsRSS Feeds

DATE FUNCTIONS

Posted By: Alexander Evans     Category: Oracle     Views: 2357

This article explains about date functions.

- DATE data type stores info about century,year,month,day,hour,minute and second for each date value.

- TO MANIPULATE AND EXTRACT VALUES from date column of a table,oracle provides some date functions.

ADD_MONTHS 

Returns date after adding the number of months.
SELECT ADD_MONTHS(sysdate,4) FROM dual;

LAST_DAY(d) 

Returns the last date of the month.
SELECT SYSDATE,LAST_DAY(sysdate)"Last" FROM DUAL;

MONTHS_BETWEEN(d1,d2) 

Returns number of months between d1 and d2.
SELECT MONTHS_BETWEEN('02-feb-92','02-dec-91') FROM DUAL;

Query : select all the orders in ascending order of month.

SELECT * from Orders ORDER BY to_char(odate,'MM');
  
Share: 

 
 
 

Didn't find what you were looking for? Find more on DATE FUNCTIONS Or get search suggestion and latest updates.

Alexander Evans
Alexander Evans author of DATE FUNCTIONS is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!