From: dmdesroches@jake.wpi.edu (David M. Desroches)
Subject: Re: Weekday in DCL
Date: 1996/01/24 [thread overview]
Message-ID: <4e6328$13n@bigboote.WPI.EDU> (raw)
In-Reply-To: DLotw5.3My@ram.nl
Marc Gobes writes:
>Q: How can I calculate the weeknumber in DCL ?
>or, if it is not possible, in (dec) C ??
Here's how we do it.
----------------------- Start of included DCL ------------------------
$!
$ date = f$cvtime(p1,"absolute")
$!
$ year = f$integer(f$cvtime(date,,"year"))
$ month = f$integer(f$cvtime(date,,"month"))
$ day = f$integer(f$cvtime(date,,"day"))
$!
$ if month .eq. 1 then -
julian_day == day
$ if month .eq. 2 then -
julian_day == 31 + day
$ if month .eq. 3 then -
julian_day == 31 + 28 + day
$ if month .eq. 4 then -
julian_day == 31 + 28 + 31 + day
$ if month .eq. 5 then -
julian_day == 31 + 28 + 31 + 30 + day
$ if month .eq. 6 then -
julian_day == 31 + 28 + 31 + 30 + 31 + day
$ if month .eq. 7 then -
julian_day == 31 + 28 + 31 + 30 + 31 + 30 + day
$ if month .eq. 8 then -
julian_day == 31 + 28 + 31 + 30 + 31 + 30 + 31 + day
$ if month .eq. 9 then -
julian_day == 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + day
$ if month .eq. 10 then -
julian_day == 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + day
$ if month .eq. 11 then -
julian_day == 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + day
$ if month .eq. 12 then -
julian_day == 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + day
$!
$ if (month .ge. 3) .and. (f$cvtime("28-feb-''year'+1-",,"day") .eqs. "29") then -
julian_day == julian_day + 1
$!
$ weekday = f$cvtime("1-jan-''year'",,"weekday")
$ if weekday .eqs. "Sunday" then -
julian_week == ((julian_day - 1) / 7) + 1
$ if weekday .eqs. "Monday" then -
julian_week == (julian_day / 7) + 1
$ if weekday .eqs. "Tuesday" then -
julian_week == ((julian_day + 1) / 7) + 1
$ if weekday .eqs. "Wednesday" then -
julian_week == ((julian_day + 2) / 7) + 1
$ if weekday .eqs. "Thursday" then -
julian_week == ((julian_day + 3) / 7) + 1
$ if weekday .eqs. "Friday" then -
julian_week == ((julian_day + 4) / 7) + 1
$ if weekday .eqs. "Saturday" then -
julian_week == ((julian_day + 5) / 7) + 1
$!
$ exit
------------------------ End of included DCL -------------------------
--
David M. Desroches | O my Jesus, forgive us our sins, save us from the
dmdesroches@jake.wpi.edu | fires of hell, and lead all souls into heaven,
Worcester Polytechnic Inst | especially those in most need of Thy mercy.
(508) 831-5487 | -- Our Lady of Fatima, 1917
prev parent reply other threads:[~1996-01-24 5:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-01-24 5:00 Weekday in DCL Marc Gobes
1996-01-24 5:00 ` David M. Desroches [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox