Take your date that you want to find the last day of, Say 19990901. Add a month to 19991001 and subtract a day. Result = 19990930 or the last day of any month, including leap years. Christopher K. Bipes mailto:ChrisB@Cross-Check.com <mailto:ChrisB@Cross-Check.com> Sr. Programmer/Analyst mailto:Chris_Bipes@Yahoo.com <mailto:Chris_Bipes@Yahoo.com> CrossCheck, Inc. http://www.cross-check.com <http://www.cross-check.com/> 6119 State Farm Drive Phone: 707 586-0551 x 1102 Rohnert Park CA 94928 Fax: 707 586-1884 ***** Note to Recruiters ***** I nor anyone that I know of is interested in any new and/or exciting positions. Please do not contact me. -----Original Message----- From: Brad McDaniel [mailto:BMCDANIEL@ABSBC.ORG] Sent: Wednesday, October 13, 1999 6:31 AM To: 'firstname.lastname@example.org' Subject: Last Day of Last Month I am writing some CL's to automate some monthly jobs that are usually submitted through user menus. This particular CL submits a job with the prior month and year as the parms (let's say &YEAR (4) and &MONTH (2)). Then, the CL does a STRQMQRY with the year, month, and day of the last day of that month. Does anyone have a sample of the easiest way to figure out the last day of a particular month (i.e. if run today, the year and month would be 1999 09, and the CL would need to pass 19990930 to the query.)? I know the method for passing parms with STRQMQRY, I am just wondering if anyone has some code laying around that gives you the last day of the month (accounting for leap years also). Thanks Brad McDaniel Information Services Annuity Board, SBC http://www.absbc.org <http://www.absbc.org> 214-720-6546 +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: email@example.com +---
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.