Skip to content

Weekday - Built-in Date & Time Function

Purpose

Weekday returns an integer indicating the day of the week from a datetime expression.

Syntax

WeekDay(datetime)

Arguments

Argument Required Description
datetime Yes Any valid datetime expression from which the weekday will be returned

Returns

Integer

See also

Example

// returns 1 (Sunday = 1 , Monday = 2 ...)
Return WeekDay(DateSerial(2014,5,30))
// Returns a text based on the compare if the weekday is monday
If (WeekDay ({OrderHeader.Order_Date}) = drMonday) Then
    Return "first day"
Else
    Return "other day"
End

Notes

  • When date cannot be converted to a datetime value, a runtime error is generated.
  • WeekDay does not use the locale settings to calculate the weekday – it always returns the same value for a specific day of the week.