|
MEMBER: SRVPGM /DEFINE DSpec /COPY ROUTINES/QRPGLESRC,SRVPGMCPY /UNDEFINE DSpec ... /eject P DayOfWeek B EXPORT ***** DayOfWeek - Calculates day of week (Monday = 1, Tuesday = 2, etc * - for any date. * - Input: WorkDate (Date field in *USA format) * - Result: WorkDay (Single digit numeric) D PI 1S 0 D WorkDate D CONST D AnySunday S D INZ(D'04/02/1995') D WorkNum S 7 0 D WorkDay S 1S 0 C WorkDate SubDur AnySunday WorkNum:*D C WorkNum Div 7 WorkNum C MvR WorkDay C If WorkDay < 1 C Return WorkDay + 7 C Else C Return WorkDay C EndIf P DayOfWeek E ... MEMBER: SRVPGMCPY ... D DayOfWeek PR 1S 0 D AnyDate D CONST DATFMT(*USA) ... Sample use: Calculates the day of the week as a single digit numeric. Accepts: A type 'D' date field, any valid format Returns: A single digit numeric. 1=Monday, 7=Sunday Sample: D Sample S D D daynbr S 1S 0 C *usa move *date sample C* If sample = '02-22-1999' then daynbr = 1 C Eval daynbr=DayOfWeek(sample) Gade_R_Reddy@gtfc.com on 10/12/99 04:59:02 PM Please respond to RPG400-L@midrange.com@Internet To: RPG400-L@midrange.com@Internet cc: Fax to: Subject: Re: date function Hey guys, Is there any way we can get the day of the week ( mon, tue.... sun) using the date functions? Gade. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.