day
extracts day from datetime
Syntax
d = day(dt, dayType)
Arguments
- dt
- dayType
string with possible values: "dayofmonth" (default value), "dayofweek", "iso-dayofweek", "dayofyear", "name" and "shortname"
- d
day value(s) (double) or day name(s) (string)
Description
d = day(dt) returns the day value(s) of the input argument
dt
.
d = day(dt, dayType) returns the day value(s) or day name(s)
depending on dayType
:
"dayofmonth", day-of-month values (default)
"dayofyear", day-of-year value, from 1 to 365 or 366.
"dayofweek", day-of-week value, from 1 to 7, where 1 corresponds to "Sunday"
"iso-dayofweek", day-of-week value, from 1 to 7, according to the ISO 8601 standard, where 1 corresponds to "Monday"
"name", full day names. If
dt
containsNaT
values, they will be replaced by ""."shortname", abbreviated day names. If
dt
containsNaT
values, they will be replaced by "".
Examples
Extracts day values from dt
dt = datetime(2025, 2, 5) d = day(dt) dt = datetime(2025, 3, 15):caldays(20):datetime(2025, 7, 26) d = day(dt)
With "dayofyear" keyword
dt = datetime() d = day(dt, "dayofyear")
With "dayofweek", "iso-dayofweek", "name" and "shortname" keyword
See also
- datetime — create points in time
History
バージョン | 記述 |
2025.1.0 | Introduction in Scilab. |
Report an issue | ||
<< datevec | Time and Date | duration >> |