WEEKDAY

Returns the day of the week for the given date value. The day is returned as an integer between 1 (Sunday) and 7 (Saturday) if no type or type=1 is specified. For other types, see the table below.

语法

WEEKDAY(serial_number; type)

serial_number」是一个日期数字。

Type is optional and determines the type of calculation.

Type

Weekday number returned

1 or omitted

1 (Sunday) through 7 (Saturday). For compatibility with Microsoft Excel.

2

1 (Monday) through 7 (Sunday).

3

0 (Monday) through 6 (Sunday)

11

1 (Monday) through 7 (Sunday).

12

1 (Tuesday) through 7 (Monday).

13

1 (Wednesday) through 7 (Tuesday).

14

1 (Thursday) through 7 (Wednesday).

15

1 (Friday) through 7 (Thursday).

16

1 (Saturday) through 7 (Friday).

17

1 (Sunday) through 7 (Saturday).


批注图标

These values apply only to the standard date format that you select under - LibreOffice Calc - Calculate.


批注图标

将日期作为公式一部分输入时,日期分隔符 (斜杠与短横线) 会被理解为算术运算符。因此,按此格式输入的日期无法正确识别为日期,导致错误计算。要保持日期作为公式一部分,请使用 DATE 函数,例如「DATE(1954;7;20)」或将日期放在引号内,使用 ISO 8601 标记法,例如「1954-07-20」。请避免使用受区域影响的日期格式,例如「07/20/54」,在其他区域设置下加载文档,会导致计算错误。


提示图标

支持 ISO 8601 日期时间格式 (及其分隔符扩展格式) 的无歧义转换。如果出现 #VALUE! 错误,请在「 - LibreOffice Calc - 公式」「详细计算设置」区域的「详细信息...」 按钮,「文本转换为数字」列表框,取消选择「生成 #VALUE! 错误」。


示例

=WEEKDAY("2000-06-14") returns 4 (the Type parameter is missing, therefore the standard count is used. The standard count starts with Sunday as day number 1. June 14, 2000 was a Wednesday and therefore day number 4).

=WEEKDAY("1996-07-24";2) returns 3 (the Type parameter is 2, therefore Monday is day number 1. July 24, 1996 was a Wednesday and therefore day number 3).

=WEEKDAY("1996-07-24";1) returns 4 (the Type parameter is 1, therefore Sunday is day number 1. July 24, 1996 was a Wednesday and therefore day number 4).

=WEEKDAY("2017-05-02";14) returns 6 (the Type parameter is 14, therefore Thursday is day number 1. May 2, 2017 was a Tuesday and therefore day number 6)

=WEEKDAY(NOW())」返回当天的数字。

提示图标

To obtain a function indicating whether a day in A1 is a business day, use the IF and WEEKDAY functions as follows:
IF(WEEKDAY(A1;2)<6;"Business day";"Weekend")