* User Supplied ISO Date
UserDate        = '20040203'
UserDateYear    = UserDate[1,4] + 0
UserDateMonth   = UserDate[5,2] + 0
UserDateDay     = UserDate[7,2] + 0
* First Day Of The Next Month
NextMonthYear   = UserDateYear + (IF (UserDateMonth + 1) > 12 THEN 1 ELSE 0)
NextMonthMonth  = (IF (UserDateMonth + 1) > 12 THEN 1 ELSE (UserDateMonth+1))
NextMonthDay    = 1
NextMonthIDate  = ICONV(NextMonthMonth:"/":NextMonthDay:"/":NextMonthYear,"D4/")
*Subtract 1 day from the first day on the next month to get the last day of the 
month supplied
UserDateIEOM = NextMonthIDate -1
UserDateEOM  = 
OCONV(UserDateIEOM,'DY'):OCONV(OCONV(UserDateIEOM,"DM"),"MR(%2)"):OCONV(OCONV(UserDateIEOM,"DD"),"MR(%2)")
*
PRINT 'NextMonthYear  = ':NextMonthYear
PRINT 'NextMonthMonth = ':NextMonthMonth
PRINT 'NextMonthDay   = ':NextMonthDay
PRINT 'EOM Internal   = ':UserDateIEOM
PRINT 'EOM ISO Date   = ':UserDateEOM
*









--
Donald Verhagen          
Application Development Manager
[EMAIL PROTECTED]
Tandem Staffing Solutions, Inc.
1690 S Congress Avenue, Suite 210
Delray Beach, FL 33445  USA
Voice Phone: 561.454.3592 Fax Phone: 561.454.3640 

>>> [EMAIL PROTECTED] 1:31:17 PM 06/02/2005 >>>
Hi,

Given a date like 20040203, I want to return the last valid date for that month 
and year (20040229 in this case). What is the shortest code fragment to achieve 
this?

At the moment I'm replacing the day with 01, then iconv, add 35 days to the 
internal date and then oconv and replace the day again with 01. I'm then on the 
first day of the next month. I then iconv, subtract 1 day and oconv.

Thanks for any help.

                
---------------------------------
Yahoo! Messenger NEW - crystal clear PC to PCcalling worldwide with voicemail
-------
u2-users mailing list
[email protected] 
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to