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:=@Year(GivenDate);
stdate:=@TextToTime("1"+"/"+"1"+"/"+@Text(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

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close