weekday - Day of week

Syntax

[N, S] = weekday(D)
[N, S] = weekday(D, form)
[N, S] = weekday(D, locale)
[N, S] = weekday(D, form, locale)

Description

[N, S] = weekday(D) returns the day of the week in numeric (N) and string (S) form for a given serial date number or date string D. Input argument D can represent more than one date in an array of serial date numbers or a cell array of date strings.

[N, S] = weekday(D, form) returns the day of the week in numeric (N) and string (S) form, where the content of S depends on the form argument. If form is 'long', then S contains the full name of the weekday (for example, Tuesday). If form is 'short', then S contains an abbreviated name (for example, Tues) from this table.

The days of the week are assigned these numbers and abbreviations.

N

S (short)

S (long)

1

Sun

Sunday

2

Mon

Monday

3

Tue

Tuesday

4

Wed

Wednesday

5

Thu

Thursday

6

Fri

Friday

7

Sat

Saturday

[N, S] = weekday(D, locale) returns the day of the week in numeric (N) and string (S) form, where the format of the output depends on the locale argument. If locale is 'local', then weekday uses local format for its output. If locale is 'en_US', then weekday uses US English.

[N, S] = weekday(D, form, locale) returns the day of the week using the formats described above for form and locale.

Examples

Either

[n, s] = weekday(728647)

or

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

returns n = 2 and s = Mon.

See Also

datenum, datestr, datevec, day

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS