Manage Learn to apply best practices and optimize your operations.

How Do You Calculate The Week Number In A Year Of A Given Date?

Given a date, this formula calculates the week number of the year in which the
date falls.
For eg.
Example 1:
-----------
1/2/2001 (This is the given date in mm/dd/yyyy format).
This formula gives the result as
The number of completed weeks as 0 since it lies in the first week of January
2001.
It also gives the day number in the week as 2. Since it is the second day of
the week.
Example 2:
------------
7/25/2001 (This is the given date in mm/dd/yyyy format).
This formula gives the result as
The number of completed weeks as 29 since it lies in the 30th week of 2001.
It also gives the day number in the week as 3. Since it is the third day of
the 30th week.
Year1:[email protected](GivenDate);
stdate:[email protected]("1"+"/"+"1"+"/"[email protected](Year1));
diffdates:=(((GivenDate - stdate) / 86400) / 7);

@Prompt([OK];"The number of completed weeks";@Text(@integer(diffdates)));

@prompt([ok];"This is the nth day of the week";@text(@modulo(((GivenDate -
stdate) / 86400);7) + 1))

Dig Deeper on Domino Resources - Part 4

SearchWindowsServer
Search400
  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

SearchDataCenter
SearchContentManagement
Close