Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the week number of a giving date

Status
Not open for further replies.

poliv

Programmer
Jun 3, 2000
48
US
I have the Lyant RM Cobol, running in a Uniware 2.1 server, and I want to calculate, in a Cobol program, the week number of the year, giving a date (yyyy/mm/dd).
How can I do this ?
Whats the beginning of week number in the year, if the 1st day of the year is in a friday ?
 
Poliv,
Use the Julian date function in RM to give you the day of the year and divide by 7, then add 1. Example: Feb 2 is the 33rd day of the year. 33/7 = 4 (throw away remainder). 4+1 = 5 (5th week of the year).
 
Hi,

look up the ISO8601 standard, also described in the Y2k manual of IBM. The first week of a year is the one with the thirsday in it.

It gives big differences with the USA compared to the ISO standard which we use in EUROPE. Here the week starts with monday. This year the difference is sometimes even 2!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top