month
extracts month from datetime
Syntax
m = month(dt, monthType)
Arguments
- dt
- monthType
string with possible values: "monthofyear" (default value), "name" and "shortname"
- m
month value(s) (double) or month name(s) (string)
Description
m = month(dt) returns the month value(s) of the input argument
dt
.
m = month(dt, monthType) returns the month value(s) or month name(s)
depending on monthType
:
"monthofyear", month value(s) (default)
"name", full month name(s). If
dt
containsNaT
values, they will be replaced by ""."shortname", abbreviated month names. If
dt
containsNaT
values, they will be replaced by "".
Examples
Extracts month value(s) from dt
dt = datetime(2025, 2, 5) m = month(dt) dt = datetime(2025, 3, 15):caldays(20):datetime(2025, 7, 26) m = month(dt)
With "name" keyword
dt = datetime(2025, 2, 5) m = month(dt, "name") dt = datetime(2025, 3, 15):calmonths(2):datetime(2025, 9, 30) m = month(dt, "name")
With "shortname" keyword
dt = datetime() m = month(dt, "shortname")
See also
- datetime — create points in time
History
バージョン | 記述 |
2025.1.0 | Introduction in Scilab. |
Report an issue | ||
<< isnat | Time and Date | NaT >> |