FUNCTION REFERENCE

month

Month number or name of each datetime.

Month number or name of each datetime.

Syntax

m = month(t)

Syntax

c = month(t, 'name')

Syntax

c = month(t, 'shortname')

Names are English and come in a cell array.

Example

m = month(datetime(2024, 3, 15))   % 3

Example

c = month(datetime(2024, 3, 15), 'name')   % {'March'}

Differences from MATLAB: Names do not follow a locale.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.