quarter

0th

Percentile

Get the fiscal quarter of a date-time.

Fiscal quarters are a way of dividing the year into fourths. The first quarter (Q1) comprises January, February and March; the second quarter (Q2) comprises April, May, June; the third quarter (Q3) comprises July, August, September; the fourth quarter (Q4) October, November, December.

Keywords
manip, methods, utilities, chron
Usage
quarter(x)
Arguments
x
a date-time object of class POSIXct, POSIXlt, Date, chron, yearmon, yearqtr, zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, fts or anything else that can be converted with as.POSIXlt
Value

  • numeric the fiscal quarter that the date-time occurs in

Aliases
  • quarter
Examples
x <- ymd(c("2012-03-26", "2012-05-04", "2012-09-23", "2012-12-31"))
# 1 2 3 4
Documentation reproduced from package lubridate, version 1.3.0, License: GPL

Community examples

ryuji1435@me.com at Jun 14, 2018 lubridate v1.7.4

x <- ymd(c("2012-03-26", "2012-05-04", "2012-09-23", "2012-12-31")) quarter(x) quarter(x, with_year = TRUE) quarter(x, with_year = TRUE, fiscal_start = 11) semester(x) semester(x, with_year = TRUE)