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¶
- Date
- DateAdd
- DateDiff
- DatePart
- DateValue
- DateSerial
- Day
- Hour
- InAgedToDays
- InLast4WeeksToSunday
- InLast7Days
- InLastFullMonth
- InLastFullWeek
- InLastYearMTD
- InLastYearYTD
- InLeapYear
- Minute
- Month
- MonthName
- Now
- Second
- Time
- TimeSerial
- TimeValue
- WeekAgo
- WeekdayName
- Year
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
datecannot 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.