x to the specified
precision. It does so
by dropping components that represent a precision that is finer than
Each calendar has its own help page describing the precisions that you can narrow to:
A calendar vector.
A precision. Allowed precisions are dependent on the calendar used.
x narrowed to the supplied
A subsecond precision
x cannot be narrowed to another subsecond precision.
You cannot narrow from, say,
clock operates under the philosophy that once you have set the subsecond
precision of a calendar, it is "locked in" at that precision. If you
expected this to use integer division to divide the nanoseconds by 1e6 to
get to millisecond precision, you probably want to convert to a time point
first, and use
# Hour precision x <- year_month_day(2019, 1, 3, 4) x#> <year_month_day<hour>> #>  "2019-01-03 04"# Narrowed to day precision calendar_narrow(x, "day")#> <year_month_day<day>> #>  "2019-01-03"# Or month precision calendar_narrow(x, "month")#> <year_month_day<month>> #>  "2019-01"