Returns the day of the week as a Number
(1
to 7
; 1
is Sunday) if date is recognized, or 0
if not (that is, if the input is invalid).
Sample usage
WEEKDAY("1/1/2019")
: 3
INDEX(LIST("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"), WEEKDAY("1/1/2019"))
returns Tue
(Text
). See also: INDEX()
, LIST()
WEEKDAY(TODAY())
returns today's numeric day of the week. See also: TODAY()
(TODAY() - WEEKDAY(TODAY()))
returns date of Saturday last week.
(TODAY() - WEEKDAY(TODAY()) + 6)
returns date of Friday this week.
(TODAY() - WEEKDAY(TODAY()) + 7 + 4)
returns date of Wednesday next week.
([Weekday] - WEEKDAY(TODAY()))
returns offset of this week's [Weekday]
(1
= Sunday, ..., 7
= Saturday) from today (for example, 0
= today, -1
= yesterday, 1
= tomorrow).
(TODAY() + ([Weekday] - WEEKDAY(TODAY())))
or (perhaps more intuitively) (TODAY() - WEEKDAY(TODAY()) + [Weekday])
returns the date of [Weekday]
within the current week.
([Date] + ([Weekday] - WEEKDAY([Date])))
or ([Date] - WEEKDAY([Date]) + [Weekday])
returns the date of [Weekday]
within a week containing [Date]
.
MOD(([Weekday] - WEEKDAY([Date]) + 7), 7)
returns the offset of the [Weekday]
on or after [Date]
. See also: MOD()
MOD(([Weekday] - WEEKDAY([Date]) - 7), 7)
returns the offset of the [Weekday]
before or on [Date]
.
([Date] + MOD(([Weekday] - WEEKDAY([Date]) + 7), 7))
returns the date of the first [Weekday]
on or after [Date]
.
([Date] + MOD(([Weekday] - WEEKDAY([Date]) - 7), 7))
returns the date of the first [Weekday]
before or on [Date]
.
([Date] - DAY([Date]) + 1)
or (EOMONTH([Date], -1) + 1)
returns the date of the first of the month containing [Date]
. See also DAY()
, EOMONTH()
(([Date] - DAY([Date]) + 1) + MOD(([Weekday] - WEEKDAY([Date] - DAY([Date]) + 1) + 7), 7))
returns the date of the first [Weekday]
of the month containing [Date]
.
(EOMONTH([Date], 0) + MOD(([Weekday] - WEEKDAY(EOMONTH([Date], 0)) - 7), 7))
returns the date of the last [Weekday]
of the month containing [Date]
.
((([Date] - DAY([Date]) + 1) + MOD(([Weekday] - WEEKDAY([Date] - DAY([Date]) + 1) + 7), 7)) + (([Ordinal] - 1) * 7))
returns the date of the [Ordinal]
-th [Weekday]
of the month containing [Date]
.
Syntax
WEEKDAY(when)
when
- ADate
orDateTime
value.
Note
Some constant values, such as "MM/DD/YYYY"
, are evaluated as a Date
value by AppSheet. Similarly, "000:00:00"
is evaluated as a Duration
value. This doesn't mean your spreadsheet data must use the same formats: the date and time formats in your spreadsheets are determined by the locale/language setting. Column will always be evaluated as the type of column. Additionally, you can convert data, both columns and string literals, to specific types using functions such as DATE()
, TIME()
, or DATETIME()
.