month

0th

Percentile

Get/set months component of a date-time.

Get/set months component of a date-time.

Keywords
manip, methods, utilities, chron
Usage
month(x, label=FALSE, abbr=TRUE)
Arguments
x
a date-time object
label
logical. TRUE will display the month as a character string such as "January." FALSE will display the month as a number.
abbr
logical. FALSE will display the month as a character string #' label, such as #' "January". TRUE will display an abbreviated version of the label, such as "Jan". abbr is #' disregarded if label = FALSE.
Details

Date-time must be a POSIXct, POSIXlt, Date, chron, yearmon, yearqtr, zoo, zooreg, timeDate, xts, its, ti, jul, timeSeries, and fts objects.

Value

  • the months element of x as a number (1-12) or character string. 1 = January.

Aliases
  • month.default
  • month.zoo
  • month.its
  • month.ti
  • month.timeseries
  • month.numeric
  • month.fts
  • month.irts
  • month
  • month<-
  • month<-.default
  • month<-.Date
  • month<-.chron
  • month<-.zoo
  • month<-.its
  • month<-.ti
  • month<-.timeDate
  • month<-.jul
  • month<-.timeSeries
  • month<-.fts
  • month<-.irts
  • month<-.yearmon
Examples
x <- now()
month(x) 
month(x) <- 1  
month(x) <- 13
month(x) > 3

month(ymd(080101))
# 1
month(ymd(080101), label = TRUE)
# "January"
month(ymd(080101), label = TRUE, abbr = TRUE)
# "Jan"
month(ymd(080101) + months(0:11), label = TRUE, abbr = TRUE)
# "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"}
Documentation reproduced from package lubridate, version 0.1, License: GPL

Community examples

Looks like there are no examples yet.