× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Glen,

In my presentations at RPG World, COMMON and in my RPG ToolKit for
OS/400 there is a procedure that using the OS/400 API to get the day of
the week.  Here is the source code for that procedure:
The input date may be any valid date data-type. If it is not a date
data-type, then simply move it into one first (any format) and then call
the GetDay procedure.

Bob Cozzi

.....D*ame+++++++++++EUDS.......Length+TDc.Functions++++++++++++++++++++
+++++++
     D GetDay          PR            10I 0
     D  InputDate                      D   CONST DATFMT(*ISO)

.....P*rocName+++++++..B...................Functions++++++++++++++++++++
+++++++
     P GetDay          B                   EXPORT
      ** Procedure interface for DayOfWeek function
.....D*ame+++++++++++EUDS.......Length+TDc.Functions++++++++++++++++++++
+++++++
     D DayOfWeek       PI            10I 0
     D  InputDate                      D   CONST DATFMT(*ISO)
     ** Base date is based on calendar changed date
     D BaseDate        S               D   INZ(D'1582-10-14')
     D nDayOfWeek      S             10I 0
     D nDays           S             10I 0
.....C*Rn01Factor1+++++++OpCode(ex)Factor2+++++++Result++++++++Len++DcHi
LoEq
     C                   TEST(E)                 InputDate
     C                   If        %ERROR
     C                   Return    -1
     C                   Endif
     C     InputDate     SubDur    BaseDate      nDays:*DAYS

     C                   CALLB     'CEEDYWK'
     C                   Parm                    nDays
     C                   Parm                    nDayofWeek

     C                   return    nDayOfWeek

     PGetDay           E



-----Original Message-----
From: rpg400-l-admin@midrange.com [mailto:rpg400-l-admin@midrange.com]
On Behalf Of Weeks, Glenn
Sent: Tuesday, December 10, 2002 4:27 PM
To: 'rpg400-l@midrange.com'
Subject: Day of the week


If I know the date, 20021215 for instance, is there an easy way to
determine the day of the week, (Monday, Tuesday, etc..). I cannot find
an example of this in any of the documentation that we have or any
online documentaion.

Any help would be appreciated.

Thanks,.

Glen Weeks
Ex. 7771


_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@midrange.com To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.