<< isnat Time and Date NaT >>

Scilab Help >> Time and Date > month

month

extracts month from datetime

Syntax

m = month(dt, monthType)

Arguments

dt

datetime

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:

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

History

VersionDescription
2025.1.0 Introduction in Scilab.

Report an issue
<< isnat Time and Date NaT >>