Weekday - returns a number representing the day of the week

Return to Introduction  Previous page  Next page

$return = Weekday(date[,firstdayofweek][,date_format])

Where:

 

$return

A number from 1 to 7 representing the day of the week.

date

The input date.

firstdayofweek

A number between 1 and 7 that specifies the day to use as the first day of the week.
1 for Sunday (default)
2 for Monday

3 for Tuesday

4 for Wednesday

5 for Thursday

6 for Friday

7 for Saturday

date_format

can be one of the following:

DMY (date is in DD/MM/YYYY format.)

MDY (date is in MM/DD/YYYY format.)

YMD (date is in YYYY/MM/DD or YYYY-MM-DD format.)

 

date_format may be omitted, in which case the date format is taken from the "Option DateFormat" command. If the "Option DateFormat" command is also omitted, then the date format is assumed to be the system short date format.

date, firstdayofweek and/or date_format may be variables.

The Weekday command returns a number between 1 and 7 for the day of the week of the input date.

Examples

$weekday = weekday($DATE)

'Returns today's weekday number in system short date format.

$weekday = Weekday("2015-01-01", YMD)

'Returns 05

$weekday = Weekday("2015-01-02", ymd)

'Returns 06

$weekday = Weekday("2015-01-01", ymd, 2)

'Returns 04

 

Sample Script

' Weekday - Display the day of the week.

MsgBox("Today is = " & WeekdayName($DATE)

exit

 

See Also:

 

DateAdd

Day

Month

MonthName

WeekdayName

Year


TN3270 Plus is continually being improved. To learn more about the latest enhancements, please review our Version History web page.