Hello,
I want to add 100 years for the TimeStamp. How to do it? Thought of adding days, but is there any other way to do this?
Thanks in advance.
Naidu Buddha
Add years to Date
Moderators: chulett, rschirm, roy
Add years to Date
Thanks and Regards
NAIDU BUDDHA
NAIDU BUDDHA
Sure, you can 'add days' as long as you don't care about leap years: 100 years in days is just + (100 * 365).
You'd have to get more sophiticated to handle this properly. From what I recall, Ken Bland has routines to do this on his website and may have posted them here as well. Ray Wurlod has Server date routines on his site as well. Both can be found via links in any of their posts, I do believe.
You'd have to get more sophiticated to handle this properly. From what I recall, Ken Bland has routines to do this on his website and may have posted them here as well. Ray Wurlod has Server date routines on his site as well. Both can be found via links in any of their posts, I do believe.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Re: Add years to Date
Probably the most simplistic approach isbmnaidu wrote:Hello,
I want to add 100 years for the TimeStamp. How to do it? Thought of adding days, but is there any other way to do this?
Thanks in advance.
Naidu Buddha
(DSJobStartTimestamp[1,4]+100):DSJobStartTimestamp[15]
replace DSJobStartTimestamp with whatever your timestamp is
2007-12-03 14:16:52 becomes 2107-12-03 14:16:52
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Don't forget February 29th.
There is a set of date arithmetic functions downloadable from here which includes AddYearsToTimestamp() function.
There is a set of date arithmetic functions downloadable from here which includes AddYearsToTimestamp() function.
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.