Package: clock 0.7.1.9000

Davis Vaughan

clock: Date-Time Types and Tools

Provides a comprehensive library for date-time manipulations using a new family of orthogonal date-time classes (durations, time points, zoned-times, and calendars) that partition responsibilities so that the complexities of time zones are only considered when they are really needed. Capabilities include: date-time parsing, formatting, arithmetic, extraction and updating of components, and rounding.

Authors:Davis Vaughan [aut, cre], Posit Software, PBC [cph, fnd]

clock_0.7.1.9000.tar.gz
clock_0.7.1.9000.zip(r-4.5)clock_0.7.1.9000.zip(r-4.4)clock_0.7.1.9000.zip(r-4.3)
clock_0.7.1.9000.tgz(r-4.4-x86_64)clock_0.7.1.9000.tgz(r-4.4-arm64)clock_0.7.1.9000.tgz(r-4.3-x86_64)clock_0.7.1.9000.tgz(r-4.3-arm64)
clock_0.7.1.9000.tar.gz(r-4.5-noble)clock_0.7.1.9000.tar.gz(r-4.4-noble)
clock_0.7.1.9000.tgz(r-4.4-emscripten)clock_0.7.1.9000.tgz(r-4.3-emscripten)
clock.pdf |clock.html
clock/json (API)
NEWS

# Install 'clock' in R:
install.packages('clock', repos = c('https://fastverse.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/r-lib/clock/issues

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:

On CRAN:

156 exports 101 stars 13.70 score 7 dependencies 365 dependents 1 mentions 282 scripts 132.5k downloads

Last updated 2 months agofrom:7bc03674f5. Checks:OK: 9. Indexed: no.

TargetResultDate
Doc / VignettesOKSep 14 2024
R-4.5-win-x86_64OKSep 14 2024
R-4.5-linux-x86_64OKSep 14 2024
R-4.4-win-x86_64OKSep 14 2024
R-4.4-mac-x86_64OKSep 14 2024
R-4.4-mac-aarch64OKSep 14 2024
R-4.3-win-x86_64OKSep 14 2024
R-4.3-mac-x86_64OKSep 14 2024
R-4.3-mac-aarch64OKSep 14 2024

Exports:add_daysadd_hoursadd_microsecondsadd_millisecondsadd_minutesadd_monthsadd_nanosecondsadd_quartersadd_secondsadd_weeksadd_yearsas_dateas_date_timeas_durationas_iso_year_week_dayas_naive_timeas_sys_timeas_weekdayas_year_dayas_year_month_dayas_year_month_weekdayas_year_quarter_dayas_year_week_dayas_zoned_timecalendar_count_betweencalendar_endcalendar_groupcalendar_leap_yearcalendar_month_factorcalendar_narrowcalendar_precisioncalendar_spanning_seqcalendar_startcalendar_widenclock_labelsclock_labels_languagesclock_labels_lookupclock_localedate_builddate_ceilingdate_count_betweendate_enddate_floordate_formatdate_groupdate_leap_yeardate_month_factordate_nowdate_parsedate_rounddate_seqdate_set_zonedate_shiftdate_spanning_seqdate_startdate_time_builddate_time_infodate_time_parsedate_time_parse_abbrevdate_time_parse_completedate_time_parse_RFC_3339date_time_set_zonedate_time_zonedate_todaydate_weekday_factordate_zoneduration_castduration_ceilingduration_daysduration_floorduration_hoursduration_microsecondsduration_millisecondsduration_minutesduration_monthsduration_nanosecondsduration_precisionduration_quartersduration_roundduration_secondsduration_spanning_seqduration_weeksduration_yearsget_dayget_hourget_indexget_microsecondget_millisecondget_minuteget_monthget_nanosecondget_quarterget_secondget_weekget_yearinvalid_anyinvalid_countinvalid_detectinvalid_removeinvalid_resolveis_durationis_iso_year_week_dayis_naive_timeis_sys_timeis_weekdayis_year_dayis_year_month_dayis_year_month_weekdayis_year_quarter_dayis_year_week_dayis_zoned_timeiso_year_week_daynaive_time_infonaive_time_parseset_dayset_hourset_indexset_microsecondset_millisecondset_minuteset_monthset_nanosecondset_quarterset_secondset_weekset_yearsys_time_infosys_time_nowsys_time_parsesys_time_parse_RFC_3339time_point_casttime_point_ceilingtime_point_count_betweentime_point_floortime_point_precisiontime_point_roundtime_point_shifttime_point_spanning_seqtzdb_namestzdb_versionweekdayweekday_codeweekday_factoryear_dayyear_month_dayyear_month_day_parseyear_month_weekdayyear_quarter_dayyear_week_dayzoned_time_infozoned_time_nowzoned_time_parse_abbrevzoned_time_parse_completezoned_time_precisionzoned_time_set_zonezoned_time_zone

Dependencies:clicpp11gluelifecyclerlangtzdbvctrs

Examples and Recipes

Rendered fromrecipes.Rmdusingknitr::rmarkdownon Sep 14 2024.

Last update: 2023-05-01
Started: 2021-02-11

Frequently Asked Questions

Rendered fromfaq.Rmdusingknitr::rmarkdownon Sep 14 2024.

Last update: 2023-05-01
Started: 2021-02-10

Getting Started

Rendered fromclock.Rmdusingknitr::rmarkdownon Sep 14 2024.

Last update: 2021-10-20
Started: 2021-02-12

Readme and manuals

Help Manual

Help pageTopics
Convert to a dateas_date as_date.clock_calendar as_date.clock_time_point as_date.clock_zoned_time as_date.Date as_date.POSIXt
Convert to a date-timeas_date_time as_date_time.clock_calendar as_date_time.clock_naive_time as_date_time.clock_sys_time as_date_time.clock_zoned_time as_date_time.Date as_date_time.POSIXt
Convert to a durationas_duration
Convert to iso-year-week-dayas_iso_year_week_day
Convert to a naive-timeas_naive_time
Convert to a sys-timeas_sys_time
Convert to a weekdayas_weekday
Convert to year-dayas_year_day
Convert to year-month-dayas_year_month_day
Convert to year-month-weekdayas_year_month_weekday
Convert to year-quarter-dayas_year_quarter_day
Convert to year-week-dayas_year_week_day
Convert to a zoned-timeas_zoned_time
Convert to a zoned-time from a dateas-zoned-time-Date as_zoned_time.Date
Convert to a zoned-time from a naive-timeas-zoned-time-naive-time as_zoned_time.clock_naive_time
Convert to a zoned-time from a date-timeas-zoned-time-posixt as_zoned_time.POSIXt
Convert to a zoned-time from a sys-timeas-zoned-time-sys-time as_zoned_time.clock_sys_time
Group calendar componentscalendar_group
Is the calendar year a leap year?calendar_leap_year
Convert a calendar to an ordered factor of month namescalendar_month_factor
Narrow a calendar to a less precise precisioncalendar_narrow
Precision: calendarcalendar_precision
Spanning sequence: calendarscalendar_spanning_seq
Widen a calendar to a more precise precisioncalendar_widen
Boundaries: calendarscalendar-boundary calendar_end calendar_start
Counting: calendarscalendar-count-between calendar_count_between
Create or retrieve date related labelsclock_labels clock_labels_languages clock_labels_lookup
Create a clock localeclock_locale
Clock arithmeticadd_days add_hours add_microseconds add_milliseconds add_minutes add_months add_nanoseconds add_quarters add_seconds add_weeks add_years clock-arithmetic
Integer codesclock-codes clock_iso_weekdays clock_months clock_weekdays
Calendar gettersclock-getters get_day get_hour get_index get_microsecond get_millisecond get_minute get_month get_nanosecond get_quarter get_second get_week get_year
Invalid calendar datesclock-invalid invalid_any invalid_count invalid_detect invalid_remove invalid_resolve
Calendar settersclock-setters set_day set_hour set_index set_microsecond set_millisecond set_minute set_month set_nanosecond set_quarter set_second set_week set_year
Building: datedate_build
Counting: date and date-timedate_count_between
Formatting: date and date-timedate_format
Group date and date-time componentsdate_group
Is the year a leap year?date_leap_year
Convert a date or date-time to an ordered factor of month namesdate_month_factor
Parsing: datedate_parse
Sequences: date and date-timedate_seq
Spanning sequence: date and date-timedate_spanning_seq
Building: date-timedate_time_build
Info: date-timedate_time_info
Convert a date or date-time to a weekday factordate_weekday_factor
Boundaries: date and date-timedate-and-date-time-boundary date_end date_start
Date and date-time roundingdate-and-date-time-rounding date_ceiling date_floor date_round
Shifting: date and date-timedate-and-date-time-shifting date_shift
Arithmetic: dateadd_days.Date add_months.Date add_quarters.Date add_weeks.Date add_years.Date Date-arithmetic
Boundaries: datedate-boundary date_end.Date date_start.Date
Counting: datedate-count-between date_count_between.Date
Formatting: datedate-formatting date_format.Date
Getters: dateDate-getters get_day.Date get_month.Date get_year.Date
Group date componentsdate-group date_group.Date
Rounding: datedate-rounding date_ceiling.Date date_floor.Date date_round.Date
Sequences: datedate-sequence date_seq.Date
Setters: dateDate-setters set_day.Date set_month.Date set_year.Date
Shifting: datedate-shifting date_shift.Date
Parsing: date-timedate-time-parse date_time_parse date_time_parse_abbrev date_time_parse_complete date_time_parse_RFC_3339
Get or set the time zonedate-time-zone date_time_set_zone date_time_zone
Current date and date-timedate-today date_now date_today
Cast a duration between precisionsduration_cast
Precision: durationduration_precision
Spanning sequence: durationduration_spanning_seq
Arithmetic: durationadd_days.clock_duration add_hours.clock_duration add_microseconds.clock_duration add_milliseconds.clock_duration add_minutes.clock_duration add_months.clock_duration add_nanoseconds.clock_duration add_quarters.clock_duration add_seconds.clock_duration add_weeks.clock_duration add_years.clock_duration duration-arithmetic
Construct a durationduration-helper duration_days duration_hours duration_microseconds duration_milliseconds duration_minutes duration_months duration_nanoseconds duration_quarters duration_seconds duration_weeks duration_years
Duration roundingduration-rounding duration_ceiling duration_floor duration_round
Formatting: zoned-timeformat.clock_zoned_time
Is 'x' a duration?is_duration
Is 'x' a iso-year-week-day?is_iso_year_week_day
Is 'x' a naive-time?is_naive_time
Is 'x' a sys-time?is_sys_time
Is 'x' a weekday?is_weekday
Is 'x' a year-day?is_year_day
Is 'x' a year-month-day?is_year_month_day
Is 'x' a year-month-weekday?is_year_month_weekday
Is 'x' a year-quarter-day?is_year_quarter_day
Is 'x' a year-week-day?is_year_week_day
Is 'x' a zoned-time?is_zoned_time
Calendar: iso-year-week-dayiso_year_week_day
Arithmetic: iso-year-week-dayadd_years.clock_iso_year_week_day iso-year-week-day-arithmetic
Boundaries: iso-year-week-daycalendar_end.clock_iso_year_week_day calendar_start.clock_iso_year_week_day iso-year-week-day-boundary
Counting: iso-year-week-daycalendar_count_between.clock_iso_year_week_day iso-year-week-day-count-between
Getters: iso-year-week-dayget_day.clock_iso_year_week_day get_hour.clock_iso_year_week_day get_microsecond.clock_iso_year_week_day get_millisecond.clock_iso_year_week_day get_minute.clock_iso_year_week_day get_nanosecond.clock_iso_year_week_day get_second.clock_iso_year_week_day get_week.clock_iso_year_week_day get_year.clock_iso_year_week_day iso-year-week-day-getters
Grouping: iso-year-week-daycalendar_group.clock_iso_year_week_day iso-year-week-day-group
Narrow: iso-year-week-daycalendar_narrow.clock_iso_year_week_day iso-year-week-day-narrow
Setters: iso-year-week-dayiso-year-week-day-setters set_day.clock_iso_year_week_day set_hour.clock_iso_year_week_day set_microsecond.clock_iso_year_week_day set_millisecond.clock_iso_year_week_day set_minute.clock_iso_year_week_day set_nanosecond.clock_iso_year_week_day set_second.clock_iso_year_week_day set_week.clock_iso_year_week_day set_year.clock_iso_year_week_day
Widen: iso-year-week-daycalendar_widen.clock_iso_year_week_day iso-year-week-day-widen
Info: naive-timenaive_time_info
Parsing: naive-timenaive_time_parse
Arithmetic: date-timeadd_days.POSIXt add_hours.POSIXt add_minutes.POSIXt add_months.POSIXt add_quarters.POSIXt add_seconds.POSIXt add_weeks.POSIXt add_years.POSIXt posixt-arithmetic
Boundaries: date-timedate_end.POSIXt date_start.POSIXt posixt-boundary
Counting: date-timesdate_count_between.POSIXt posixt-count-between
Formatting: date-timedate_format.POSIXt posixt-formatting
Getters: date-timeget_day.POSIXt get_hour.POSIXt get_minute.POSIXt get_month.POSIXt get_second.POSIXt get_year.POSIXt posixt-getters
Group date-time componentsdate_group.POSIXt posixt-group
Rounding: date-timedate_ceiling.POSIXt date_floor.POSIXt date_round.POSIXt posixt-rounding
Sequences: date-timedate_seq.POSIXt posixt-sequence
Setters: date-timeposixt-setters set_day.POSIXt set_hour.POSIXt set_minute.POSIXt set_month.POSIXt set_second.POSIXt set_year.POSIXt
Shifting: date and date-timedate_shift.POSIXt posixt-shifting
Sequences: durationseq.clock_duration
Sequences: iso-year-week-dayseq.clock_iso_year_week_day
Sequences: time pointsseq.clock_time_point
Sequences: year-dayseq.clock_year_day
Sequences: year-month-dayseq.clock_year_month_day
Sequences: year-month-weekdayseq.clock_year_month_weekday
Sequences: year-quarter-dayseq.clock_year_quarter_day
Sequences: year-week-dayseq.clock_year_week_day
Info: sys-timesys_time_info
What is the current sys-time?sys_time_now
Parsing: sys-timesys-parsing sys_time_parse sys_time_parse_RFC_3339
Cast a time point between precisionstime_point_cast
Counting: time pointtime_point_count_between
Precision: time pointtime_point_precision
Shifting: time pointtime_point_shift
Spanning sequence: time pointstime_point_spanning_seq
Arithmetic: Time pointsadd_days.clock_time_point add_hours.clock_time_point add_microseconds.clock_time_point add_milliseconds.clock_time_point add_minutes.clock_time_point add_nanoseconds.clock_time_point add_seconds.clock_time_point add_weeks.clock_time_point time-point-arithmetic
Time point roundingtime-point-rounding time_point_ceiling time_point_floor time_point_round
Support for vctrs arithmeticclock-arith vec_arith.clock_iso_year_week_day vec_arith.clock_naive_time vec_arith.clock_sys_time vec_arith.clock_weekday vec_arith.clock_year_day vec_arith.clock_year_month_day vec_arith.clock_year_month_weekday vec_arith.clock_year_quarter_day vec_arith.clock_year_week_day
Construct a weekday vectorweekday
Extract underlying weekday codesweekday_code
Convert a weekday to an ordered factorweekday_factor
Arithmetic: weekdayadd_days.clock_weekday weekday-arithmetic
Calendar: year-dayyear_day
Calendar: year-month-dayyear_month_day
Parsing: year-month-dayyear_month_day_parse
Calendar: year-month-weekdayyear_month_weekday
Calendar: year-quarter-dayyear_quarter_day
Calendar: year-week-dayyear_week_day
Arithmetic: year-dayadd_years.clock_year_day year-day-arithmetic
Boundaries: year-daycalendar_end.clock_year_day calendar_start.clock_year_day year-day-boundary
Counting: year-daycalendar_count_between.clock_year_day year-day-count-between
Getters: year-dayget_day.clock_year_day get_hour.clock_year_day get_microsecond.clock_year_day get_millisecond.clock_year_day get_minute.clock_year_day get_nanosecond.clock_year_day get_second.clock_year_day get_year.clock_year_day year-day-getters
Grouping: year-daycalendar_group.clock_year_day year-day-group
Narrow: year-daycalendar_narrow.clock_year_day year-day-narrow
Setters: year-dayset_day.clock_year_day set_hour.clock_year_day set_microsecond.clock_year_day set_millisecond.clock_year_day set_minute.clock_year_day set_nanosecond.clock_year_day set_second.clock_year_day set_year.clock_year_day year-day-setters
Widen: year-daycalendar_widen.clock_year_day year-day-widen
Arithmetic: year-month-dayadd_months.clock_year_month_day add_quarters.clock_year_month_day add_years.clock_year_month_day year-month-day-arithmetic
Boundaries: year-month-daycalendar_end.clock_year_month_day calendar_start.clock_year_month_day year-month-day-boundary
Counting: year-month-daycalendar_count_between.clock_year_month_day year-month-day-count-between
Getters: year-month-dayget_day.clock_year_month_day get_hour.clock_year_month_day get_microsecond.clock_year_month_day get_millisecond.clock_year_month_day get_minute.clock_year_month_day get_month.clock_year_month_day get_nanosecond.clock_year_month_day get_second.clock_year_month_day get_year.clock_year_month_day year-month-day-getters
Grouping: year-month-daycalendar_group.clock_year_month_day year-month-day-group
Narrow: year-month-daycalendar_narrow.clock_year_month_day year-month-day-narrow
Setters: year-month-dayset_day.clock_year_month_day set_hour.clock_year_month_day set_microsecond.clock_year_month_day set_millisecond.clock_year_month_day set_minute.clock_year_month_day set_month.clock_year_month_day set_nanosecond.clock_year_month_day set_second.clock_year_month_day set_year.clock_year_month_day year-month-day-setters
Widen: year-month-daycalendar_widen.clock_year_month_day year-month-day-widen
Arithmetic: year-month-weekdayadd_months.clock_year_month_weekday add_quarters.clock_year_month_weekday add_years.clock_year_month_weekday year-month-weekday-arithmetic
Boundaries: year-month-weekdaycalendar_end.clock_year_month_weekday calendar_start.clock_year_month_weekday year-month-weekday-boundary
Counting: year-month-weekdaycalendar_count_between.clock_year_month_weekday year-month-weekday-count-between
Getters: year-month-weekdayget_day.clock_year_month_weekday get_hour.clock_year_month_weekday get_index.clock_year_month_weekday get_microsecond.clock_year_month_weekday get_millisecond.clock_year_month_weekday get_minute.clock_year_month_weekday get_month.clock_year_month_weekday get_nanosecond.clock_year_month_weekday get_second.clock_year_month_weekday get_year.clock_year_month_weekday year-month-weekday-getters
Grouping: year-month-weekdaycalendar_group.clock_year_month_weekday year-month-weekday-group
Narrow: year-month-weekdaycalendar_narrow.clock_year_month_weekday year-month-weekday-narrow
Setters: year-month-weekdayset_day.clock_year_month_weekday set_hour.clock_year_month_weekday set_index.clock_year_month_weekday set_microsecond.clock_year_month_weekday set_millisecond.clock_year_month_weekday set_minute.clock_year_month_weekday set_month.clock_year_month_weekday set_nanosecond.clock_year_month_weekday set_second.clock_year_month_weekday set_year.clock_year_month_weekday year-month-weekday-setters
Widen: year-month-weekdaycalendar_widen.clock_year_month_weekday year-month-weekday-widen
Arithmetic: year-quarter-dayadd_quarters.clock_year_quarter_day add_years.clock_year_quarter_day year-quarter-day-arithmetic
Boundaries: year-quarter-daycalendar_end.clock_year_quarter_day calendar_start.clock_year_quarter_day year-quarter-day-boundary
Counting: year-quarter-daycalendar_count_between.clock_year_quarter_day year-quarter-day-count-between
Getters: year-quarter-dayget_day.clock_year_quarter_day get_hour.clock_year_quarter_day get_microsecond.clock_year_quarter_day get_millisecond.clock_year_quarter_day get_minute.clock_year_quarter_day get_nanosecond.clock_year_quarter_day get_quarter.clock_year_quarter_day get_second.clock_year_quarter_day get_year.clock_year_quarter_day year-quarter-day-getters
Grouping: year-quarter-daycalendar_group.clock_year_quarter_day year-quarter-day-group
Narrow: year-quarter-daycalendar_narrow.clock_year_quarter_day year-quarter-day-narrow
Setters: year-quarter-dayset_day.clock_year_quarter_day set_hour.clock_year_quarter_day set_microsecond.clock_year_quarter_day set_millisecond.clock_year_quarter_day set_minute.clock_year_quarter_day set_nanosecond.clock_year_quarter_day set_quarter.clock_year_quarter_day set_second.clock_year_quarter_day set_year.clock_year_quarter_day year-quarter-day-setters
Widen: year-quarter-daycalendar_widen.clock_year_quarter_day year-quarter-day-widen
Arithmetic: year-week-dayadd_years.clock_year_week_day year-week-day-arithmetic
Boundaries: year-week-daycalendar_end.clock_year_week_day calendar_start.clock_year_week_day year-week-day-boundary
Counting: year-week-daycalendar_count_between.clock_year_week_day year-week-day-count-between
Getters: year-week-dayget_day.clock_year_week_day get_hour.clock_year_week_day get_microsecond.clock_year_week_day get_millisecond.clock_year_week_day get_minute.clock_year_week_day get_nanosecond.clock_year_week_day get_second.clock_year_week_day get_week.clock_year_week_day get_year.clock_year_week_day year-week-day-getters
Grouping: year-week-daycalendar_group.clock_year_week_day year-week-day-group
Narrow: year-week-daycalendar_narrow.clock_year_week_day year-week-day-narrow
Setters: year-week-dayset_day.clock_year_week_day set_hour.clock_year_week_day set_microsecond.clock_year_week_day set_millisecond.clock_year_week_day set_minute.clock_year_week_day set_nanosecond.clock_year_week_day set_second.clock_year_week_day set_week.clock_year_week_day set_year.clock_year_week_day year-week-day-setters
Widen: year-week-daycalendar_widen.clock_year_week_day year-week-day-widen
Info: zoned-timezoned_time_info
What is the current zoned-time?zoned_time_now
Precision: zoned-timezoned_time_precision
Parsing: zoned-timezoned-parsing zoned_time_parse_abbrev zoned_time_parse_complete
Get or set the time zonezoned-zone zoned_time_set_zone zoned_time_zone