R/getDateTimeParts.R

Defines functions getSec.default getSec getMin.default getMin getHour.default getHour getDay.POSIXlt getDay.default getDay getMonth.POSIXlt getMonth.default getMonth getYear.POSIXlt getYear.default getYear

Documented in getDay getDay.default getDay.POSIXlt getHour getHour.default getMin getMin.default getMonth getMonth.default getMonth.POSIXlt getSec getSec.default getYear getYear.default getYear.POSIXlt

getYear <- function(x, format, ...)
  UseMethod("getYear")

getYear.default <- function(x, format, ...)
  stop("'getYear' can only be used on objects of a date/time class")

getYear.Date <-
getYear.POSIXct <-
getYear.POSIXlt <- function(x, format="%Y", ...)
  format(x=x, format=format, ...)

getMonth <- function(x, format, ...)
  UseMethod("getMonth")

getMonth.default <- function(x, format, ...)
  stop("'getMonth' can only be used on objects of a date/time class")

getMonth.Date <-
getMonth.POSIXct <-
getMonth.POSIXlt <- function(x, format="%m", ...)
  format(x=x, format=format)

getDay <- function(x, format, ...)
  UseMethod("getDay")

getDay.default <- function(x, format, ...)
  stop("'getDay' can only be used on objects of a date/time class")

getDay.Date <-
getDay.POSIXct <-
getDay.POSIXlt <- function(x, format="%d", ...)
  format(x=x, format=format)

getHour <- function(x, format, ...)
  UseMethod("getHour")

getHour.default <- function(x, format, ...)
  stop("'getHour' can only be used on objects of a date/time class")

getMin <- function(x, format, ...)
  UseMethod("getMin")

getMin.default <- function(x, format, ...)
  stop("'getMin' can only be used on objects of a date/time class")

getSec <- function(x, format, ...)
  UseMethod("getSec")

getSec.default <- function(x, format, ...)
  stop("'getSec' can only be used on objects of a date/time class")

Try the gdata package in your browser

Any scripts or data that you put into this service are public.

gdata documentation built on Oct. 17, 2023, 1:11 a.m.