x <- as.Date("2019-01-01")
# Dates are assumed to be naive, so the printed time is the same whether
# we convert it to sys-time or naive-time
as_sys_time(x)
as_naive_time(x)
y <- as.POSIXct("2019-01-01 01:00:00", tz = "America/New_York")
# The sys time displays the equivalent time in UTC (5 hours ahead of
# America/New_York at this point in the year)
as_sys_time(y)
ym <- year_month_day(2019, 02)
# A minimum of day precision is required
try(as_sys_time(ym))
ymd <- set_day(ym, 10)
as_sys_time(ymd)
Run the code above in your browser using DataLab