# NOT RUN {
x <- as.POSIXct("2009-08-03")
x + days(1) + hours(6) + minutes(30)
x + days(100) - hours(8)
class(as.Date("2009-08-09") + days(1)) # retains Date class
as.Date("2009-08-09") + hours(12)
class(as.Date("2009-08-09") + hours(12))
# converts to POSIXt class to accomodate time units
years(1) - months(7)
c(1:3) * hours(1)
hours(1:3)
#sequencing
y <- ymd(090101) # "2009-01-01 CST"
y + months(0:11)
# compare DST handling to durations
boundary <- as.POSIXct("2009-03-08 01:59:59")
boundary + days(1) # period
boundary + ddays(1) # duration
# seconds later)
# }
Run the code above in your browser using DataLab