Returns the calendar week a number


      Week( [<dDate>][, <lSWN>] ) -> nWeek


<dDate> Designates a date for which the week it lies in, is determined. The default is the system date.

<lSWN> Simple Week Number ( see below description )


WEEK() returns a sequential week number that designates in which week of the year <dDate> lies.


Week() returns the calendar week a number. If no date is specified, the system date is used. An empty date via hb_SToD(“”) returns 0. The week of the year in which a day lies is information required by a number of technical financial calculations or wage accounting. This function determines this week and acknowledged all calendar rules. If <lSWN> is .T., Week() will calculate the “simple week number”, defined by – week #1 starts on January, 1st – week #(n+1) starts seven days after start of week #n If <lSWN> is .F. (default), the ISO8601 week number, defined by – weeks start on mondays – week #1 is the one that includes January, 4 will be calculated.


. When no date is specified, then WEEK() uses the system date. An empty date leads to a 0 result.


       Determine the week for a date:
       dDate  :=  CTOD("03/14/92")
       ? "This date is in week:  ", WEEK(dDate)


Week() is compatible with CT3’s Week(). <lSWN> is Harbour extention.




Source is dattime2.prg, library is libct.


CDoW(), CToDoW(), DoW()

2 responses to “Week()

  1. Pingback: Harbour Date & Time Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – W | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.