View previous topic :: View next topic
|
Author |
Message |
abhishek mitra
New User
Joined: 24 Feb 2008 Posts: 48 Location: Kolkata
|
|
|
|
Hi,
Just wanted to know can a Integer-of-date function handle the change of year or leap year.
what i mean is that
will Integer-of-date('20093112') + 1 give a date of 01/01/2010?
will integer-of-date(20080228')) + 1 give a date of 29/02/2008? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
it would be embarassing if not |
|
Back to top |
|
|
abhishek mitra
New User
Joined: 24 Feb 2008 Posts: 48 Location: Kolkata
|
|
|
|
enrico-sorichetti wrote: |
it would be embarassing if not |
Thanks a lot |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Have you read the manual (link at the top of the page) on the INTEGER-OF-DATE function? The manual specifically states that INTEGER-OF-DATE converts a YYYYMMDD value into an integer in the range 1 to 3,067,671 (January 1, 1601 to December 31, 9999). Adding 1 to an integer as long as it stays in this range will be fine.
Converting the integer back into a date via the DATE-OF-INTEGER function is listed as being valid for all integers between 1 and 3,067,671. So as long as your integer stays in this range, you can manipulate the value any way you want, being confident that the date resulting will be the correct and valid date. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Always remember, Intrinsic Functions (unlike their LE counterparts) will crash and burn if the data passed to them is invalid.
LE will populate the first two-bytes of the 12-Byte Feedback Parm with a value of other than X'0000' when bad data is passed.
But, FUNCTIONS and their LE counterparts should not be mixed, unless you use the correct compile option, which will make them uniform.
Bill |
|
Back to top |
|
|
|