month
Extract month numbers or names from date and time values.
📝Syntax
m = month(t)
name = month(t, 'name')
abbr = month(t, 'shortname')
📥Input Arguments
Parameter Description
inputs datetime values, serial date numbers, or date-compatible input, plus optional name output selector.
📤Output Arguments
Parameter Description
output A double array of month numbers, or a string array of month names.
📄Description

Extract month numbers or names from date and time values.

Use name for full English month names and shortname for abbreviated names.

Array-valued inputs keep their data shape when the operation supports arrays. Scalar operands are expanded where the implementation defines scalar expansion.

💡Examples
Basic usage.
month(datetime(2024, 5, 17))
month(datetime(2024, 5, 17), 'name')
🔗See Also
datetimeduration
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub