Week Number in Year
Moderators: chulett, rschirm, roy
Week Number in Year
Hi, is there an easy way to obtain the week number in year using Oconv (1 to 52)? (I know that I can use Oconv(Arg1, "DW") to get the day of the week as a number). I could probably work this out using stage variables and sequence numbers, but I was just wondering if this was possible.
Thanks
Thanks
Garth
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
Garthmac,
I think that there are a number of different methods of computing the calendar week. I would start off with the following:
This would be CW 1 for days 1 through 6 of the year, 2 for 7 through 13 and so on. Modify to your specific CW requirements at will
I think that there are a number of different methods of computing the calendar week. I would start off with the following:
Code: Select all
INT(OCONV({InternalDate},"DJ")/7)+1
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Garthmac,
I just remember doing this once and it wasn't the correct formula (it was in Germany and I recall looking up a DIN norm for the calendar week; something to do with the number of days in the first week of the year changing the start date...)
I just remember doing this once and it wasn't the correct formula (it was in Germany and I recall looking up a DIN norm for the calendar week; something to do with the number of days in the first week of the year changing the start date...)
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The business rule is documented in the Transform or the Routine that it invokes. (It's in the Code of the Routine, to explain why the particular algorithm used was chosen.)
This is one of the advantages of documentation.
This is one of the advantages of documentation.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.