Search notes:

R: Date class

In R, a date is specified as the number of days since January 1st 1970, with dates prior to that date being stored as negative numbers. Although it's technically possible to store fractional days, the Date object is not intended to store hours, minutes and seconds.
dt <- as.Date('1970-01-01')

typeof(dt)
# [1] "double"

as.numberic(dt)
# [1] 0

dt <- as.Date('1970-01-05')
as.numeric(dt)
# [1] 4
In order to not only store dates but also hours, minutes and seconds in an R variable, a date time class such as POSIXct should be used.

See also

as.Date, Sys.Date
R classes

Index