Learn R Programming

lubridate (version 1.9.4)

date_decimal: Converts a decimal to a date

Description

Converts a decimal to a date

Usage

date_decimal(decimal, tz = "UTC")

Value

a POSIXct object, whose year corresponds to the integer part of decimal. The months, days, hours, minutes and seconds elements are picked so the date-time will accurately represent the fraction of the year expressed by decimal.

Arguments

decimal

a numeric object

tz

the time zone required

Examples

Run this code
date <- ymd("2009-02-10")
decimal <- decimal_date(date) # 2009.11
date_decimal(decimal) # "2009-02-10 UTC"

Run the code above in your browser using DataLab