title: Week-number calculation
body: <p>I have a problem with code which used to calculate the week number from date.
  The application is Report Builder.
  The language is: Report Application Programming (RAP)The RAP language is identical to Object Pascal.</p>
  
  <p>My written code works for the years 2017 and 2018.
  But it doesn`t work for 2019 and 2020.</p>
  
  <p>Does someone have an Idea what I´m doing wrong here?</p>
  
  <pre><code>if (AVX['P_DELDATE'] &gt;= 42737) and (AVX['P_DELDATE'] &lt;= 43100) {= Jahr        2017} then begin
  Value:= (AVX['P_DELDATE'] - 1 - (42737-1) + 7-((AVX['P_DELDATE'] -1 - (42737-1) ) mod 7))/7;
  end else begin
  
  if (AVX['P_DELDATE'] &gt;= 43101) and (AVX['P_DELDATE'] &lt;= 43465) {= Jahr 2018} then begin
  Value:= (AVX['P_DELDATE'] - 1 - (43101-1) + 7-((AVX['P_DELDATE'] -1 -  (43101-1) ) mod 7))/7;
  end;
  end else begin
  
  if (AVX['P_DELDATE'] &gt;= 43466) and (AVX['P_DELDATE'] &lt;= 43830) {= Jahr  2019} then begin
  Value:= (AVX['P_DELDATE'] - 1 - (43466-1) + 7-((AVX['P_DELDATE'] -1 - (43466-1) ) mod 7))/7;
  end;
  end else begin
  
  if (AVX['P_DELDATE'] &gt;= 43831) and (AVX['P_DELDATE'] &lt;= 44196) {= Jahr 2020} then begin
  Value:= (AVX['P_DELDATE'] - 1 - (43831-1) + 7-((AVX['P_DELDATE'] -1 - (43831-1) ) mod 7))/7;
  end;
  end;
  end;
  </code></pre>