` Printed Icetips Article

Icetips Article



Par2: Week of year
2001-01-17 -- Pascal Gulikers
 
Actually, this is the correct one:

CLC_WEE        PROCEDURE  (pDate)               ! Declare Procedure
lThisThursday        LONG
lFirstThursday       LONG
  CODE
  ! weekno's according to ISO 8601:

  ! - week starts at monday
  ! - first thursday of year is always in week 1
  ! - 4th of Januari always in week 1

  if pDate < 1 then return(0).

  lThisThursday  = pDate - ((pDate - 1) % 7) + 3
  lFirstThursday = date(1,1,year(lThisThursday)) + 6 -
((date(1,1,year(lThisThursday)) + 2) % 7)

  return((lThisThursday - lFirstThursday) / 7 + 1)



Printed November 23, 2024, 8:19 pm
This article has been viewed/printed 35215 times.