Weekday: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
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 | For more information about firstdayofweek constants, see [[Datediff]]. | ||
'''Table 26: WEEKDAY return values''' | '''Table 26: WEEKDAY return values''' | ||
| Line 29: | Line 29: | ||
|} | |} | ||
== Example == | |||
<pre> | <pre> | ||
Rem WeekDay Example | |||
' | 'WeekDay returns day of week as an integer | ||
Dim IndepDay, Birthday | |||
IndepDay = | IndepDay = WeekDay("July 4, 1776") | ||
PRINT " | PRINT "Weekday of July 4, 1776:", IndepDay | ||
Birthday = | Birthday = WeekDay("12/27/70") | ||
PRINT " | PRINT "Wweekday of 12/27/70:", Birthday | ||
</pre> | </pre> | ||
== Output == | |||
<pre> | <pre> | ||
Weekday of July 4, 1776: 5 | |||
Weekday of 12/27/70:1 | |||
</pre> | </pre> | ||
== Related Items == | |||
[[datediff|DATEDIFF]] | [[datediff|DATEDIFF]] | ||
[[Category:Language Reference]] | |||
Revision as of 04:17, 17 August 2012
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
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 "Wweekday of 12/27/70:", Birthday
Output
Weekday of July 4, 1776: 5 Weekday of 12/27/70:1