Weekday: Difference between revisions
Jump to navigation
Jump to search
Add Javascript snippet and fix spelling error |
Add related items |
||
Line 61: | Line 61: | ||
Weekday of 12/27/70: 1 | Weekday of 12/27/70: 1 | ||
</pre> | </pre> | ||
== Related Items == | |||
[[weekdayname|WeekdayName]] | |||
[[Category:Language Reference]] | [[Category:Language Reference]] | ||
[[Category:Date and Time]] | [[Category:Date and Time]] |
Revision as of 15:41, 18 May 2013
WeekDay(date[, firstdayofweek])
Description
WeekDay returns an integer representing the day of week from a given date. The required parameter, date, is a numeric expression, a string expression, or any valid expression that can represent a date. The optional parameter, firstdayofweek, is Sunday, if not specified. The return value is an integer from the table below.
For more information about firstdayofweek constants, see DateDiff.
Table 26: WEEKDAY return values
Constant | Value | Description |
---|---|---|
vbSunday | 1 | Sunday |
vbMonday | 2 | Monday |
vbTuesday | 3 | Tuesday |
vbWednesday | 4 | Wednesday |
vbThursday | 5 | Thursday |
vbFriday | 6 | Friday |
vbSaturday | 7 | Saturday |
Example (Basic)
Rem WeekDay Example 'WeekDay returns day of week as an integer Dim IndepDay, Birthday IndepDay = WeekDay("July 4, 1776") PRINT "Weekday of July 4, 1776:", IndepDay Birthday = WeekDay("12/27/70") PRINT "Weekday of 12/27/70:", Birthday
Example (JavaScript)
// WeekDay Example /* WeekDay returns day of week as an integer */ var IndepDay, Birthday; IndepDay = new Date("July 4, 1776").getDay()+1; NSB.Print("Weekday of July 4, 1776: " + IndepDay); Birthday = new Date("12/27/70"); NSB.Print("Weekday of 12/27/70: " + (Birthday.getDay()+1));
Output
Weekday of July 4, 1776: 5 Weekday of 12/27/70: 1