Monday, 22 March 2010

First day, last day of current previous and next month

To get first day of current month: 

select trunc(sysdate,'mm') from dual
 
To get last day of current month:

select trunc(last_day(sysdate)) from dual
 
To get first day of previous month:

select trunc(add_months(sysdate,-1),'mm') from dual

 To get last day of previous month:

select trunc(last_day(add_months(sysdate,-1))) from dual
 
To get first day of next month:

select trunc(add_months(sysdate,1),'mm') from dual
 
To get last day of next month:

select trunc(last_day(add_months(sysdate,1))) from dual
  
 

No comments:

Post a Comment