quarter
Returns the quarter that a given date string, s falls in.
Syntax
R = quarter(s)
R = quarter(s, quarterstart)
Inputs
- s
- A string representing a date in the format dd-mmm-yyyy.
- quarterstart
- An optional argument that specifies the month in which the first quarter of a year begins. By default, the value for month is 1 (January).
Outputs
- R
- Number which represents the quarter that the given date, s, is in.
Examples:
Return quarter from a date string with default quarter start:
R = quarter('10-Jun-2019')
R = 5
Return quarter from a date string, with quarter start month specified:
R = quarter('10-Dec-2019', 7)
R = 2
Version History
2024.1