Returning week number of the month

Asked

Viewed 739 times

4

In January this year (2018) I have 5 weeks in the same, being them:

1 week: 1 to 7;

2 week: 8 to 14;

3 week: 15 to 21;

4 week: 22 to 28 and

5 week: 29 to 31 (or 29 to 04 February).

When using the function WeekOfTheYearthe application returns me the day 29 as being week 1, which is not true.

Any solution to this problem?

1 answer

5


Maybe this can help you:

weekNum: Integer; 
weekNum:=(StrToInt(FormatDateTime('dd',Date)) - 1) div 7 + 1 ;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.