Function Reference
— Function File: [n, s] = weekday (d, [form])

Return the day of week as a number in n and a string in s, for example [1, "Sun"], [2, "Mon"], ..., or [7, "Sat"].

d is a serial date number or a date string.

If the string form is given and is "long", s will contain the full name of the weekday; otherwise (or if form is "short"), s will contain the abbreviated name of the weekday.

See also: datenum datevec eomday

Demonstration 1

The following code

 [n, s] = weekday (now ())

Produces the following output

n =  2
s = Mon

Demonstration 2

The following code

 [n, s] = weekday (728647)

Produces the following output

n =  2
s = Mon

Demonstration 3

The following code

 [n, s] = weekday ('19-Dec-1994')

Produces the following output

n =  2
s = Mon