This string function returns the weekday name of a Julian date or weekday name of a weekday number based on one of four metrics for weekday numbering.

See this note.


// For date values, the n2 is ignored
string WeekDayName(double d[,  int n1, int n2])
// For number values, n2 defines the weekday number metric
string WeekDayName(int d[,  int n1, int n2])



is a Julian Date Value which can include Time, or it is a number in the range of the weekday number as defined by n2.


is the option to indicate output string length. There are four options
-1 Returns first 3 English letter of the weekday name (upper case)
0 Returns full name (initial caps)
1 Returns first character of weekday name (upper case)
3 (default) Returns first 3 English letter of the weekday name (initial caps)


is an integer value to define weekday number as following four options
0 0 (Sunday) through 6 (Saturday)
1 1 (Sunday) through 7 (Saturday)
2 0 (Monday) through 6 (Sunday)
3 (default) 1 (Monday) through 7 (Sunday)


Four variants of the name of a weekday can be returned. For invalid date, return empty.


string strname$=WeekDayName(2, 0)$;
strname$=; // Should return ''Tue'' since nAbbr is 3 and nOpt default is Monday = 1
string strname$=WeekDayName(2454825,-1)$; // 2454825 = date(12/25/2008)
strname$=; // Should return THU


Origin Worksheet columns have a Day of Week format which displays number values as a weekday using one of three Display formats. The numbering system used in this case is always 0 = Sunday to 6 = Saturday and uses the modulus 7 for values larger than 6. The WeekDayName function does not use modulus and the argument must be in the range specified by n2.

See Also

WeekNum, Year, Month, Day, Hour, Minute, Second, Now, WeekDay