Documentation/Calc Functions/WEEKNUM/en

Function name:
WEEKNUM

Category:
Date and Time

Summary:
Determines the week number for a date specified either by a date-time serial number or in a text string. Several week numbering systems exist and so WEEKNUM accepts an argument which can be used to select how week 1 of the year is defined and which day is taken as the first day of the week.

Syntax:
WEEKNUM(Date [; Mode])

Returns:
Returns an integer in the range [0, 53] which is the week number for the given date, numbered in accordance with the supplied Mode argument.

Arguments:
Date is the date string (in quotation marks) or a date-time serial number, or a reference to the cell containing one of those types, which is the date for which the calculation is to be carried out.

Mode is an integer which defines the first week in the year and sets the start of the week. The possible values for Mode, and their meanings, are listed in the following table. In this table the Definition of Week 1 column distinguishes between two methods for selecting week 1 in the year – one method defines week 1 as the week that includes January 1; the second method defines week 1 as the week that contains the first Thursday in the year (this is the method recommended in ISO 8601). If omitted the default value for Mode is 1.


 * If Date is not a valid date expression, then WEEKNUM reports a #VALUE! error.
 * WEEKNUM ignores any time components of Date.
 * If Mode is non-numeric, then WEEKNUM reports a #VALUE! error.
 * If Mode is a non-integer value, then WEEKNUM truncates the value.
 * If (after possible truncation) Mode is not one of the expected values enumerated above, then WEEKNUM returns an invalid argument error (Err:502).
 * If interoperability with Microsoft Excel is important for your spreadsheet then avoid using the Mode value of 150, which is in ODF 1.2 but is not supported by Excel.

Related LibreOffice functions:
DAY

ISOWEEKNUM

MONTH

WEEKDAY

WEEKNUM_EXCEL2003

YEAR

ODF standard:
Section 6.10.21, part 2

Equivalent Excel functions:
WEEKNUM