I want to substract 3 moths from date field. I would appreciate if anyone tells me how do it.
Thanks in advance.
Add/substract months from date
Moderators: chulett, rschirm, roy
-
- Charter Member
- Posts: 38
- Joined: Wed Mar 17, 2004 1:16 am
- Location: USA
Using the followiing
example:
OutPutDate = DateFromDaysSince(-90, Link.InputDate)..
but there needs to be more rigor wrapped around for the Month of Feb, as well as Leap Year calculation...
..another sure shot method is ..if u can extract this data from a DB, using a User Defined Query ( like using a TimestampDiff function or a dateDiff function on the DB side ), that way u can avoid using complex Xfm( using stage Variables) to take Leap Year and the Month of Feb into Consideration...
example:
OutPutDate = DateFromDaysSince(-90, Link.InputDate)..
but there needs to be more rigor wrapped around for the Month of Feb, as well as Leap Year calculation...
..another sure shot method is ..if u can extract this data from a DB, using a User Defined Query ( like using a TimestampDiff function or a dateDiff function on the DB side ), that way u can avoid using complex Xfm( using stage Variables) to take Leap Year and the Month of Feb into Consideration...
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Of course, 3 months can be anywhere between 90 and 92 days. Other variations are possible if you're dealing with the years when "they" fiddled with the calendar. A more robust solution would manipulate the month number and, as a possible consequence, the year and day numbers.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.