@Weekday (JavaScript)

Returns the day of the week where Sunday is 1.

Defined in

@Functions (JavaScript)

Syntax

@WeekDay(time:Date) : int
Parameter Description
time A date and time.
Return value Description
int The day of the week that corresponds to the date and time. Sunday is 1, Monday is 2, and so on.

Usage

Computes the day of the week and returns a number that identifies the day. Weekday numbers are 1 through 7, with Sunday = 1, Monday = 2, and so on.

Examples

This example gets the day of the week for today.
function p(stuff) {
	print("<<<" + stuff + ">>>");
}

var w = "";
switch(@Weekday(@Today())) {
	case 1 : w = "Sunday"; break;
	case 2 : w = "Monday"; break;
	case 3 : w = "Tuesday"; break;
	case 4 : w = "Wednesday"; break;
	case 5 : w = "Thursday"; break;
	case 6 : w = "Friday"; break;
	case 7 : w = "Saturday"; break;
}
p("Today is " + w + ".");