WeekNumberEx

Purpose

This function returns the week number of the year for the given date, just like WeekNumber, except that you can specify the conditions for determining the first week of the year.

Parameters

Parameter: In Date
Type: date
Description: This is the date for which you wish to know the week number.

Parameter: Week Mode
Type: integer (Optional)
Description: This specifies how the first week of the year is determined, according to the following table:

Week Mode Value

Result

1

The first week of the year starts with the first calendar day of the year, regardless of the day of the week it falls upon.

4

The first week of the year is determined by the first week with at least four days in the new year.

(Use WeekNumber)

The first week of the year is determined by the first full week starting on Sunday in the new year.

If this parameter is omitted, the value 1 is assumed (first calendar day of the year).

Returns

Return value: WeekNumber
Type: short integer
Description: This is the week number of the year for the given date and Week Mode.

See Also

DaysInMonth
DaysLeftInMonth

DaysLeftInYear

WeeksLeftInYear

WeeksLeftInYearEx
WeekNumber