Home » SQL & PL/SQL » SQL & PL/SQL » First Day of next month
First Day of next month [message #35581] Thu, 17 February 2005 07:03 Go to next message
sheela
Messages: 66
Registered: March 2002
Member
Hello everyone,

Can anyone tell me how to get first day of next month? I will be passing in Month and year as a parameter.

For example

Instead of passing the complete sysdate, I will be passing in 02/2005 and I need to get 03/01/2005 from the resultant query..

thanks in advance
Sheela
Re: First Day of next month [message #35582 is a reply to message #35581] Thu, 17 February 2005 07:47 Go to previous messageGo to next message
Jayan
Messages: 27
Registered: February 2005
Junior Member
Hi,
this satisfies yr. requirement

****************************************************
Can anyone tell me how to get first day of next month? I will be passing in Month and year as a parameter.

For example

Instead of passing the complete sysdate, I will be passing in 02/2005 and I need to get 03/01/2005 from the resultant query..
****************************************************

Select to_char(ADD_MONTHS(Trunc(TO_DATE('02/2005','MM/YYYY'),'MONTH'),1),'mm/dd/yyyy') "First_DayOf_Next_Month"
FROM DUAL;
Re: First Day of next month [message #35583 is a reply to message #35582] Thu, 17 February 2005 08:03 Go to previous messageGo to next message
sheela
Messages: 66
Registered: March 2002
Member
Thanks a lot Jayan.I tested it out . IT works and does satisfy my requirements

Rgds
Sheela
Re: First Day of next month [message #35584 is a reply to message #35581] Thu, 17 February 2005 08:12 Go to previous messageGo to next message
scerch
Messages: 38
Registered: September 2004
Member
select trunc(add_months(sysdate, 1),'mon') from dual;

TRUNC(ADD_M
-----------
01-MAR-2005
Re: First Day of next month [message #35585 is a reply to message #35582] Thu, 17 February 2005 08:14 Go to previous messageGo to next message
scerch
Messages: 38
Registered: September 2004
Member
Oh, sorry, I did not see your answer. Same thing.
Re: First Day of next month [message #35587 is a reply to message #35585] Thu, 17 February 2005 09:36 Go to previous messageGo to next message
Jaime Stuardo
Messages: 57
Registered: March 2004
Member
Why not simply use:
select last_day(to_date('02/2005', 'MM/YYYY')) + 1
from dual

Jaime
Re: First Day of next month [message #35589 is a reply to message #35584] Thu, 17 February 2005 10:40 Go to previous messageGo to next message
sheela
Messages: 66
Registered: March 2002
Member
Thanks all of U for taking time to respond to my question.
Re: First Day of next month [message #110565 is a reply to message #35581] Tue, 08 March 2005 13:51 Go to previous message
plgladio
Messages: 19
Registered: March 2005
Location: Vellore
Junior Member
select to_char(last_day(sysdate)+1) from dual
Previous Topic: SOUNDEX function in Oracle
Next Topic: performance of query on a view
Goto Forum:
  


Current Time: Wed Jul 23 21:24:59 CDT 2025