I am sure somebody out there can help me. I would like to work out the week
number from the current date.
For example if the current day happens to be the 20th of Jan 2000, the
week number will be 3
( because week 3 is from 17th to 23rd of Jan 2000) and for 16th of Feb the
week will be 7.
In short from the current date , it should be possible to determine to
which week the particular date belongs.
Thank you in advance
Jay
This approach would work for several years in future, but it is not as neat
as a pure mathematical formula. It would be interesting to learn if such a
formula exists, and if the "week of year" number differs in different
countries. In Sweden we regularly plan meetings and such a things using week
numbers in stead of dates, so this is quite an important issue for us.
Seppo Nurmi
Sveriges Riksbank
Stockholm
Sweden
> -----Ursprungligt meddelande-----
> Från: Jay Pillai [SMTP:Jay_P...@SWISSRE.COM]
> Skickat: den 17 januari 2000 20:29
> Till: TSO-...@VM.MARIST.EDU
> Ämne: REXX Calculate Week No. from Current date
here's my solution:
/* rexx */
select
when date("w",date(d) - (date(d) - 1),"d") = "Monday" ,
& date("d") // 7 > 0 then
do
week = date(d) % 7 + 1
end
when date("w",date(d) - (date(d) - 1),"d") = "Tuesday" then
do
week = date(d) % 7 + 1
end
when date("w",date(d) - (date(d) - 1),"d") = "Wednesday" ,
& date("d") // 7 = 6 then
do
week = date(d) % 7 + 2
end
when date("w",date(d) - (date(d) - 1),"d") = "Wednesday" ,
& date("d") // 7 < 6 then
do
week = date(d) % 7 + 1
end
when date("w",date(d) - (date(d) - 1),"d") = "Thursday" ,
& date("d") // 7 < 4 then
do
week = date(d) % 7 + 2
end
when date("w",date(d) - (date(d) - 1),"d") = "Thursday" ,
& date("d") // 7 >= 4 then
do
week = date(d) % 7 + 1
end
when date("w",date(d) - (date(d) - 1),"d") = "Friday" ,
& date("d") // 7 >= 4 then
do
week = date(d) % 7 + 1
end
when date("w",date(d) - (date(d) - 1),"d") = "Saturday" ,
& date("d") // 7 >= 3 then
do
week = date(d) % 7 + 1
end
when date("w",date(d) - (date(d) - 1),"d") = "Sunday" ,
& date("d") // 7 >= 2 then
do
week = date(d) % 7 + 1
end
otherwise
do
week = date(d) % 7
end
end
say week
exit
____________________________________________________
Mit freundlichen Gruessen/Best regards
REWE-Informations-Systeme GmbH
Michael Krause
RIS/LIBS - NRZ - Raum 14
Raiffeisenstrasse 5-9
D-61191 Rosbach vor der Hoehe
Telefon: 0049(0)6003/85-2877
0049(0)6101/542 444 (privat)
Telefax: 0049(0)6003/85-6-2877
eMail: Michael...@rewe.de (Office)
Michael...@rhein-main.net (Home)
The rule for Germany is: Monday is first day in week and the first 4-day
week is week 1 in new year.
I think, this is the rule for European Community.
Michael
____________________________________________________
Mit freundlichen Gruessen/Best regards
REWE-Informations-Systeme GmbH
Michael Krause
RIS/LIBS - NRZ - Raum 14
Raiffeisenstrasse 5-9
D-61191 Rosbach vor der Hoehe
Telefon: 0049(0)6003/85-2877
0049(0)6101/542 444 (privat)
Telefax: 0049(0)6003/85-6-2877
eMail: Michael...@rewe.de (Office)
Michael...@rhein-main.net (Home)
> Ämne: REXX Calculate Week No. from Current date
> The rule for Germany is: Monday is first day in week and the first 4-day
> week is week 1 in new year.
>
> I think, this is the rule for European Community.
are you sure? Did you derive this from any norming (DIN or its
successor)?
As far as I know, week number "1" is the week with the first Wednesday
of the year.
Ralf
"Krause, Michael" wrote:
> Hi, Seppo
>
> The rule for Germany is: Monday is first day in week and the first 4-day
> week is week 1 in new year.
>
> I think, this is the rule for European Community.
>
True (week with 4 days)
ISO 8601 defines this. The week with first Thursday.
--
Birger Heede
IBM Global Services, Denmark