Function Reference


_DateToDayOfWeek

Returns the weekday number for a given date

#include <Date.au3>
_DateToDayOfWeek ( $iYear, $iMonth, $iDay )

Parameters

$iYear A valid year in format YYYY
$iMonth A valid month in format MM
$iDay A valid day in format DD

Return Value

Success: the day of the Week Range is 1 to 7 where 1=Sunday.
Failure: 0 and sets the @error flag to non-zero.
@error: 1 - Invalid Input Date

Related

_DateAdd, _DateDayOfWeek, _DateDiff, _DateToDayOfWeekISO, _DayValueToDate

Example

#include <Date.au3>
#include <MsgBoxConstants.au3>

; Week day number for a given date
Local $iWeekday = _DateToDayOfWeek(@YEAR, @MON, @MDAY)
; Should be equal to @WDAY
MsgBox($MB_SYSTEMMODAL, "", "Todays WeekdayNumber is: " & $iWeekday)
MsgBox($MB_SYSTEMMODAL, "", "Today is a : " & _DateDayOfWeek($iWeekday))