Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
weekday
Day's index and name in its week for given dates
Syntax
[I, Names] = weekday() [I, Names] = weekday(N) [I, Names] = weekday(YMD) [I, Names] = weekday(Y, M, D) [I, Names] = weekday(dateStrings) [I, Names] = weekday(.., "long") [I, Names] = weekday(.., la_NG)
Arguments
- N
Array of decimal date numbers as returned by
datenum(..)
.- YMD
Matrix of decimal integers with n rows and 3 columns. Each row defines a date: Year numbers are in column
YMD(:,1)
. Month indices in [1,12] are in columnYMD(:,2)
. Day indices in [1,31] are in columnYMD(:,3)
.- Y, M, D
3 element-wise arrays of decimal integers with the same sizes. The date #i is defined by
D(i)/M(i)/Y(i)
.- dateStrings
Array of strings specifying dates according to 5 possible formats described here-below. In the array, all the dates must follow the same format:
"YYYY-MM-DD"
:DD < 10
or/andMM < 10
must have a leading zero. Example:"2017-09-07"
."YYYY-MM-DD HH:MN:SS.ss"
or"YYYY-MM-DD whatever you want"
: same as above. Only the part before the first space is considered."D/M/Y"
: DaysD < 10
or/and MonthsM < 10
may or not have a leading zero. Example:"7/09/2017"
."enD/M/Y"
: Same as above, with the prefix "en" (for "english") and M/D instead of D/M. Example:"en7/24/2017"
."D-Mmm-YYYY"
whereMmm
is the short name of the Month in english:Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec
. DaysD < 10
may or not have a leading zero.
- "long"
Optional keyword to get days names in long full form: "Wednesday" instead of "Wed", etc. Can be used anywhere after the Days input argument(s).
- la_NG
Optional keyword = unique string specifying the language in which days names are requested, in the standard format like "en_US", "fr_FR", etc. Can be used anywhere after the Days input argument(s).
- I
Array of decimal integers in [1,7], having the sizes of
N
,YMD(:,1)
,Y, M and D
, ordateStrings
: 1 is for Sunday, 2 for Monday, .., 7 for Saturday.- Names
Array of text words having
I
sizes: Names of days in their weeks, for the given dates. Names are returned in short form like "Wed" standing for "Wednesday", unless the"long"
option is used.
Description
For each given dates, or by default for today, weekday
computes and
returns the integer index of the day in its week, from 1 to 7. The abbreviated or full
name of the day may also be returned, in the Scilab session language. If a language code
is provided and targets a language supported in Scilab, the day name is translated into
the language before being returned.
Lang | i | short | long | ....... | Lang | i | short | long |
---|---|---|---|---|---|---|---|---|
en_US | 1 | Sun | Sunday | pt_BR | 1 | Dom | Domingo | |
en_US | 2 | Mon | Monday | pt_BR | 2 | Seg | Segunda-feira | |
en_US | 3 | Tue | Tuesday | pt_BR | 3 | Ter | Terça-feira | |
en_US | 4 | Wed | Wednesday | pt_BR | 4 | Qua | Quarta-feira | |
en_US | 5 | Thu | Thursday | pt_BR | 5 | Qui | Quinta-feira | |
en_US | 6 | Fri | Friday | pt_BR | 6 | Sex | Sexta-feira | |
en_US | 7 | Sat | Saturday | pt_BR | 7 | Sáb | Sábado | |
fr_FR | 1 | Dim. | Dimanche | ru_RU | 1 | Вск | Воскресенье | |
fr_FR | 2 | Lun. | Lundi | ru_RU | 2 | Пнд | Понедельник | |
fr_FR | 3 | Mar. | Mardi | ru_RU | 3 | Втр | Вторник | |
fr_FR | 4 | Mer. | Mercredi | ru_RU | 4 | Срд | Среда | |
fr_FR | 5 | Jeu. | Jeudi | ru_RU | 5 | Чтв | Четверг | |
fr_FR | 6 | Ven. | Vendredi | ru_RU | 6 | Птн | Пятница | |
fr_FR | 7 | Sam. | Samedi | ru_RU | 7 | Сбт | Суббота | |
ja_JP | 1 | 日 | 日曜日 | zh_CN | 1 | 星期日 | 星期日 | |
ja_JP | 2 | 月 | 月曜日 | zh_CN | 2 | 星期一 | 星期一 | |
ja_JP | 3 | 火 | 火曜日 | zh_CN | 3 | 星期二 | 星期二 | |
ja_JP | 4 | 水 | 水曜日 | zh_CN | 4 | 星期三 | 星期三 | |
ja_JP | 5 | 木 | 木曜日 | zh_CN | 5 | 星期四 | 星期四 | |
ja_JP | 6 | 金 | 金曜日 | zh_CN | 6 | 星期五 | 星期五 | |
ja_JP | 7 | 土 | 土曜日 | zh_CN | 7 | 星期六 | 星期六 |
Examples
// Today [i, n] = weekday() [i, n] = weekday("long"); n [i, n] = weekday("long","ru_RU"); n // Explicit input dates [I, N] = weekday( ["01/1/1970" "11/09/2001" "26/12/2004"]) [I, N] = weekday("en"+["1/01/1970" "09/11/2001" "12/26/2004"]) [I, N] = weekday(["1/1/1970" "11/9/2001" "26/12/2004"], "long"); N [I, N] = weekday(["1970-01-01" "2001-09-11" "2004-12-26"], "long"); N [I, N] = weekday(["1970-01-01 00:00:00" "2001-09-11 08:14:00" "2004-12-26 00:58:53"], "long"); N [I, N] = weekday(["1-Jan-1970" "11-Sep-2001" "26-Dec-2004"], "long"); N [I, N] = weekday(["1970-01-01" "en12/26/2004"]); // => error: all dates must have the same format [I, N] = weekday([1970 1 1 ; 2001 9 11 ; 2004 12 26], "long"); N [I, N] = weekday([1970 2001 2004], [1 9 12], [1 11 26], "long"); N D = datenum([1970 1 1 ; 2001 9 11 ; 2004 12 26]) [I, N] = weekday(D, "long"); N // Language option [I, N] = weekday(["1/1/1970" "11/9/2001" "26/12/2004"], "zh_CN"); N [I, N] = weekday(["1/1/1970" "11/9/2001" "26/12/2004"], "fr_FR", "long"); N
History
バージョン | 記述 |
6.1.0 |
|
Report an issue | ||
<< toc | Time and Date | Output functions >> |