Rdate2str: Conversion between date-time strings and R date-time objects

Rdate2strR Documentation

Conversion between date-time strings and R date-time objects

Description

str2Rdate: Convert a string representation of a date-time into an R date-time object of type (POSIXt, POSIXct).

Rdate2str: Convert an R date-time object into a string of a desired string format.

Usage

Rdate2str(date, format = "%Y-%m-%d %H:%M:%S")

str2Rdate(ts, format = "%Y-%m-%d %H:%M:%S")

Arguments

date

a date-time object of type POSIXt, POSIXct

ts

a date-time string having the format of format

format

the format to be used for the output string. For the list of items see the help page of strptime

Details

These functions invoke the built-in functions format, as.POSIXct and strptime.

Value

str2Rdate: a date-time object of R (POSIXt, POSIXct) which is essentially the number of seconds since some fixed time. Rdate2str: a string with a sequence of the sort year - month - day - time following the format specification in argument format.

Author(s)

Christoph Frei

See Also

year, month, day

Examples

hello.e <- str2Rdate("1977.09.28", format="%Y.%m.%d")
Rdate2str(hello.e-5597*86400,format="%Y-%m-%d")


metno/gibson documentation built on Feb. 12, 2024, 7:25 a.m.