quarter
Extract quarter numbers from date and time values.
📝Syntax
q = quarter(t)
📥Input Arguments
Parameter Description
inputs datetime values, serial date numbers, or date-compatible input.
📤Output Arguments
Parameter Description
output A double array with values from 1 to 4.
📄Description

Extract quarter numbers from date and time values.

quarter is computed from the calendar month using ceil(month(t)/3).

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.
quarter(datetime(2024, [1 4 7 10], 1))
🔗See Also
datetimeduration
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub