Hi,
I have a requirement like this . I need to add a month from input date which Iam getting as varchar (8) . For example 20071201 it must be 20080101 and it must take care of leap years also . Can some body help me in this.
Thanks,
Somaraju.
Adding the Month
Moderators: chulett, rschirm, roy
Adding the Month
somaraju
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
FLOOR(No_Of_Months/12) will give you years to be added/subtracted and
(No_Of_Months MOD 12) will give you months to be added/subtracted
This should give you the lead to your solution. A solution to subtract months is given in this LINK, tweak this code if you want to add, won't be that difficult.
(No_Of_Months MOD 12) will give you months to be added/subtracted
This should give you the lead to your solution. A solution to subtract months is given in this LINK, tweak this code if you want to add, won't be that difficult.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>