a character string specifying the time unit to be rounded to. Should be one of
"second", "minute", "hour", "day", "week", "month", "quarter", or "year."
change_on_boundary
logical. If FALSE (the default) ceiling_date
don't alter date-times on the corresponding boundary. The boundary is unit
dependent. For second, minute, hour and day the boundary is '00' of next
smaller unit. For week, month etc the boundary is on the first day within
that unit. For example for the boundary date "2000-01-01"
ceiling_date(ymd("2000-01-01"), "month") is "2000-01-01"
while 'ceiling_date(ymd("2000-01-01"), "month", TRUE)' is "2000-02-01". You
can change this option globally with
options(lubridate.ceiling_date.change_on_boundary = TRUE).
Details
round_date takes a date-time object and rounds it to the nearest
integer value of the specified time unit. For rounding date-ties which is
exactly halfway between two consecutive units, the convention is to round
up. Note that this is in line with the behavior of R's base
round.POSIXt function but does not follow the convention of the
base round function which "goes to the even digit" per IEC
60559.
floor_date takes a date-time object and rounds it down to the nearest integer
value of the specified time unit.
ceiling_date takes a date-time object and rounds it up to the nearest
integer value of the specified time unit.
By convention the boundary for a month is the first second of the month. Thus
floor_date(ymd("2000-03-01"), "month") gives "2000-03-01 UTC".