Learn R Programming

fame (version 1.05)

as.POSIXct.jul: Date-time Conversion Functions

Description

Functions to create objects of classes "POSIXlt" and "POSIXct" representing calendar dates and times.

Usage

## S3 method for class 'jul':
as.POSIXct(x, \dots)
## S3 method for class 'ti':
as.POSIXct(x, \dots)
as.POSIXlt(x, tz = "", ...)
## S3 method for class 'default':
as.POSIXlt(x, tz = "", \dots)
## S3 method for class 'Date':
as.POSIXlt(x, \dots)
## S3 method for class 'jul':
as.POSIXlt(x, \dots)
## S3 method for class 'ti':
as.POSIXlt(x, \dots)
## S3 method for class 'POSIXlt':
as.POSIXlt(x, tz = "", \dots)

Arguments

x
An object to be converted.
tz
A timezone specification to be used for the conversion, if one is required. System-specific, but "" is the current timezone, and "GMT" is UTC (Coordinated Universal Time, in French).
...
other args passed to underlying functions

Value

  • as.POSIXct and as.POSIXlt return objects of the appropriate class. If tz was specified, as.POSIXlt will give an appropriate "tzone" attribute.

Details

The as.POSIX* functions convert an object to one of the two classes used to represent date/times (calendar dates plus time to the nearest second). They can take convert a wide variety of objects, including objects of the other class and of classes "Date", "date" (from package date or survival), "chron" and "dates" (from package chron) to these classes. Dates are treated as being at midnight UTC.

They can also convert character strings of the formats "2001-02-03" and "2001/02/03" optionally followed by white space and a time in the format "14:52" or "14:52:03". (Formats such as "01/02/03" are ambiguous but can be converted via a format specification by strptime.)

Logical NAs can be converted to either of the classes, but no other logical vectors can be.

asPOSIXlt is generic, while the other functions documented here are methods for the generic as.POSIX* functions that convert objects to the POSIXct and POSIXlt classes.

See Also

as.POSIXct and link{as.POSIXlt} for the generic functions, and DateTimeClasses for details of the classes.