home *** CD-ROM | disk | FTP | other *** search
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- Path: sparky!uunet!paladin.american.edu!auvm!AMAIL.AMDAHL.COM!CHIP.DAVIS
- X-Delivery-Notice: SMTP MAIL FROM does not correspond to sender.
- Message-ID: <m0mA8o4-0000cyC@juts.ccc.amdahl.com>
- Newsgroups: comp.lang.rexx
- Date: Mon, 20 Jul 1992 21:07:00 ET
- Sender: REXX Programming discussion list <REXXLIST@UGA.BITNET>
- From: chip.davis@AMAIL.AMDAHL.COM
- Subject: Re: Determining weekday given a date
- Comments: To: TSO-REXX%ucf1vm.cc.ucf.edu@juts.ccc.amdahl.com,
- REXXLIST%ucf1vm.cc.ucf.edu@juts.ccc.amdahl.com
- Lines: 28
-
- On Tuesday, 14 July 1992 12:50 PT, ts0007 said:
- >
- > Has anyone written a routine to take a date in the future
- > in some form (e.g. 080292), and determine if the day is a weekday (M-F)
- > or Sat/Sun?
- >
- > Perhaps someone knows of a way to easily do this.
-
- The following exec will probably do what you want, and is considerably
- shorter than the universal CA/ACM routine posted.
- -Chip-
-
- ------------------Top of Exec-------------------------
- /* Return the weekday name for an arbitrary date in this century */
- wk = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'
- Parse Var wk wkday.0 wkday.1 wkday.2 wkday.3 wkday.4 wkday.5 wkday.6 .
- Parse Value 31 30 30 30 30 With m. m.4 m.6 m.9 m.11 .
- Parse Arg mm . '/' dd . '/' yy .
- yr = yy + (yy = 0) * 100
- m.2 = (yr // 4 = 0) + 28
- d0 = ((yr - 1) % 4 + yr) // 7
- d = 0
- Do i = 1 To mm - 1
- d = d + m.i
- End i
- d = (d + dd + d0) // 7
- Return wkday.d
- -----------------------End of Exec-------------------------
-