julian
Extract Parts of a Date or POSIXt Object

Description

Extracts the julian time, month, quarter, or weekday from a Date or POSIXt object.

Usage

julian(x, ...)
## S3 method for class 'Date':
julian(x, origin = as.Date("1970-01-01"), ...)
## S3 method for class 'POSIXt':
julian(x, origin = as.POSIXct("1970-01-01", 
   tz = "GMT"), ...)

months(x, abbreviate) ## S3 method for class 'Date': months(x, abbreviate = FALSE) ## S3 method for class 'POSIXt': months(x, abbreviate = FALSE)

quarters(x, abbreviate) ## S3 method for class 'Date': quarters(x, ...) ## S3 method for class 'POSIXt': quarters(x, ...)

weekdays(x, abbreviate) ## S3 method for class 'Date': weekdays(x, abbreviate = FALSE) ## S3 method for class 'POSIXt': weekdays(x, abbreviate = FALSE)

Arguments

x a Date or POSIXt object.
origin a Date or POSIXt object specifying the origin of the julian time.
abbreviate a logical value specifying if the return value should be abbreviated.
... additional arguments.
Value
julian returns the number of days since the time origin, as a numeric vector for julian.Date and as a difftime object for julian.POSIXt, with an attribute origin.
months, quarters, weekdays returns a character vector denoting the months, quarters, or weekdays of the time objects specified.
See Also
Date, POSIXt
Examples
(dt <- as.Date(c("1970-01-01", "2038-01-19")))
format(dt, "%a %b %d %H:%M:%S %Y")
julian(dt)
months(dt, abbreviate = TRUE)
quarters(dt)
weekdays(dt, abbreviate = TRUE)

pct <- as.POSIXct(c("1970-01-01 00:00:00", "2038-01-19 03:14:07"), tz = "GMT") julian(pct) plt <- as.POSIXlt(c("1970-01-01 00:00:00", "2038-01-19 03:14:07"), tz = "") julian(plt, origin = as.POSIXlt("1970-01-01", tz = ""))

Package base version 6.1.1-7
Package Index