Main Content

quarter

Quarter number of input date and time

Description

example

q = quarter(t) returns the quarter numbers for each date and time specified in t.

The q output is a double array containing integer values from 1 to 4.

Examples

collapse all

t = datetime(2013,05,31):calmonths(3):datetime(2014,05,31)
t = 1x5 datetime
   31-May-2013   31-Aug-2013   30-Nov-2013   28-Feb-2014   31-May-2014

q = quarter(t)
q = 1×5

     2     3     4     1     2

Input Arguments

collapse all

Input date and time, specified as a datetime array.

To support existing code that previously required Financial Toolbox™, quarter also accepts serial date numbers and text as inputs, but they are not recommended. For more information, see Version History.

Extended Capabilities

Version History

Introduced in R2014b

expand all

Not recommended starting in R2022a

See Also

| | |