From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,a2f7ac718593d6ea,start X-Google-Attributes: gid1164f8,public From: dmdesroches@jake.wpi.edu (David M. Desroches) Subject: Re: Weekday in DCL Date: 1996/01/24 Message-ID: <4e6328$13n@bigboote.WPI.EDU>#1/1 X-Deja-AN: 135939617 distribution: world references: organization: Worcester Polytechnic Institute reply-to: dmdesroches@jake.wpi.edu newsgroups: comp.sys.dec 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