Documentation/Calc Functions/WEEKS

Function name:
WEEKS

Category:
Date and Time

Summary:
Calculates the number of weeks between two dates.

Syntax:
WEEKS(StartDate; EndDate; Type)

Returns:
Returns an integer value which is the difference between the two given dates in weeks, depending on the calculation mode selected through the Type argument.

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

EndDate is the date (in quotation marks) or a date-time serial number, or a reference to the cell containing one of those types, which is either the end date or the start date of the period for which the calculation is to be carried out.

Type is an integer value, either 0 or 1. If Type is 0, then WEEKS returns the number of whole 7-day periods between StartDate and EndDate. If Type is 1, WEEKS calculates the Monday-to-Sunday week that StartDate and EndDate each lie in, and returns the difference between those week numbers.


 * If either StartDate or EndDate is not a valid date expression, then WEEKS reports a #VALUE! error.


 * If StartDate is earlier than EndDate, the result is a positive number; if StartDate is later than EndDate, the result is a negative number.


 * WEEKS ignores any time components of StartDate and EndDate.


 * If Type is non-numeric, then WEEKS reports a #VALUE! error.


 * If Type is a non-integer value, then WEEKS truncates it to an integer.


 * If (after truncation) Type is not equal to either 0 or 1, then WEEKS reports an invalid argument error (Err:502).

Details specific to WEEKS function
WEEKS is not part of the ODF 1.2 international standard and should not be regarded as portable.

Related LibreOffice functions:
DAYS

MONTHS

YEARS

ODF standard:
None.

Equivalent Excel functions:
None.