Package: clock 0.7.1
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:
clock_0.7.1.tar.gz
clock_0.7.1.tar.gz(r-4.5-noble)clock_0.7.1.tar.gz(r-4.4-noble)
clock_0.7.1.tgz(r-4.4-emscripten)clock_0.7.1.tgz(r-4.3-emscripten)
clock.pdf |clock.html✨
clock/json (API)
NEWS
# Install 'clock' in R: |
install.packages('clock', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org')) |
Bug tracker:https://github.com/r-lib/clock/issues
- clock_iso_weekdays - Integer codes
- clock_months - Integer codes
- clock_weekdays - Integer codes
Last updated 4 months agofrom:6a6adc1e46. Checks:OK: 2. Indexed: no.
Target | Result | Date |
---|---|---|
Doc / Vignettes | OK | Oct 17 2024 |
R-4.5-linux-x86_64 | OK | Oct 17 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
Examples and Recipes
Rendered fromrecipes.Rmd
usingknitr::rmarkdown
on Oct 17 2024.Last update: 2023-05-15
Started: 2021-03-31
Frequently Asked Questions
Rendered fromfaq.Rmd
usingknitr::rmarkdown
on Oct 17 2024.Last update: 2023-05-15
Started: 2021-03-31
Getting Started
Rendered fromclock.Rmd
usingknitr::rmarkdown
on Oct 17 2024.Last update: 2021-10-29
Started: 2021-03-31
Readme and manuals
Help Manual
Help page | Topics |
---|---|
Convert to a date | as_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-time | as_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 duration | as_duration |
Convert to iso-year-week-day | as_iso_year_week_day |
Convert to a naive-time | as_naive_time |
Convert to a sys-time | as_sys_time |
Convert to a weekday | as_weekday |
Convert to year-day | as_year_day |
Convert to year-month-day | as_year_month_day |
Convert to year-month-weekday | as_year_month_weekday |
Convert to year-quarter-day | as_year_quarter_day |
Convert to year-week-day | as_year_week_day |
Convert to a zoned-time | as_zoned_time |
Convert to a zoned-time from a date | as-zoned-time-Date as_zoned_time.Date |
Convert to a zoned-time from a naive-time | as-zoned-time-naive-time as_zoned_time.clock_naive_time |
Convert to a zoned-time from a date-time | as-zoned-time-posixt as_zoned_time.POSIXt |
Convert to a zoned-time from a sys-time | as-zoned-time-sys-time as_zoned_time.clock_sys_time |
Group calendar components | calendar_group |
Is the calendar year a leap year? | calendar_leap_year |
Convert a calendar to an ordered factor of month names | calendar_month_factor |
Narrow a calendar to a less precise precision | calendar_narrow |
Precision: calendar | calendar_precision |
Spanning sequence: calendars | calendar_spanning_seq |
Widen a calendar to a more precise precision | calendar_widen |
Boundaries: calendars | calendar-boundary calendar_end calendar_start |
Counting: calendars | calendar-count-between calendar_count_between |
Create or retrieve date related labels | clock_labels clock_labels_languages clock_labels_lookup |
Create a clock locale | clock_locale |
Clock arithmetic | add_days add_hours add_microseconds add_milliseconds add_minutes add_months add_nanoseconds add_quarters add_seconds add_weeks add_years clock-arithmetic |
Integer codes | clock-codes clock_iso_weekdays clock_months clock_weekdays |
Calendar getters | clock-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 dates | clock-invalid invalid_any invalid_count invalid_detect invalid_remove invalid_resolve |
Calendar setters | clock-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: date | date_build |
Counting: date and date-time | date_count_between |
Formatting: date and date-time | date_format |
Group date and date-time components | date_group |
Is the year a leap year? | date_leap_year |
Convert a date or date-time to an ordered factor of month names | date_month_factor |
Parsing: date | date_parse |
Sequences: date and date-time | date_seq |
Spanning sequence: date and date-time | date_spanning_seq |
Building: date-time | date_time_build |
Info: date-time | date_time_info |
Convert a date or date-time to a weekday factor | date_weekday_factor |
Boundaries: date and date-time | date-and-date-time-boundary date_end date_start |
Date and date-time rounding | date-and-date-time-rounding date_ceiling date_floor date_round |
Shifting: date and date-time | date-and-date-time-shifting date_shift |
Arithmetic: date | add_days.Date add_months.Date add_quarters.Date add_weeks.Date add_years.Date Date-arithmetic |
Boundaries: date | date-boundary date_end.Date date_start.Date |
Counting: date | date-count-between date_count_between.Date |
Formatting: date | date-formatting date_format.Date |
Getters: date | Date-getters get_day.Date get_month.Date get_year.Date |
Group date components | date-group date_group.Date |
Rounding: date | date-rounding date_ceiling.Date date_floor.Date date_round.Date |
Sequences: date | date-sequence date_seq.Date |
Setters: date | Date-setters set_day.Date set_month.Date set_year.Date |
Shifting: date | date-shifting date_shift.Date |
Parsing: date-time | date-time-parse date_time_parse date_time_parse_abbrev date_time_parse_complete date_time_parse_RFC_3339 |
Get or set the time zone | date-time-zone date_time_set_zone date_time_zone |
Current date and date-time | date-today date_now date_today |
Cast a duration between precisions | duration_cast |
Precision: duration | duration_precision |
Spanning sequence: duration | duration_spanning_seq |
Arithmetic: duration | add_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 duration | duration-helper duration_days duration_hours duration_microseconds duration_milliseconds duration_minutes duration_months duration_nanoseconds duration_quarters duration_seconds duration_weeks duration_years |
Duration rounding | duration-rounding duration_ceiling duration_floor duration_round |
Formatting: zoned-time | format.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-day | iso_year_week_day |
Arithmetic: iso-year-week-day | add_years.clock_iso_year_week_day iso-year-week-day-arithmetic |
Boundaries: iso-year-week-day | calendar_end.clock_iso_year_week_day calendar_start.clock_iso_year_week_day iso-year-week-day-boundary |
Counting: iso-year-week-day | calendar_count_between.clock_iso_year_week_day iso-year-week-day-count-between |
Getters: iso-year-week-day | get_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-day | calendar_group.clock_iso_year_week_day iso-year-week-day-group |
Narrow: iso-year-week-day | calendar_narrow.clock_iso_year_week_day iso-year-week-day-narrow |
Setters: iso-year-week-day | iso-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-day | calendar_widen.clock_iso_year_week_day iso-year-week-day-widen |
Info: naive-time | naive_time_info |
Parsing: naive-time | naive_time_parse |
Arithmetic: date-time | add_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-time | date_end.POSIXt date_start.POSIXt posixt-boundary |
Counting: date-times | date_count_between.POSIXt posixt-count-between |
Formatting: date-time | date_format.POSIXt posixt-formatting |
Getters: date-time | get_day.POSIXt get_hour.POSIXt get_minute.POSIXt get_month.POSIXt get_second.POSIXt get_year.POSIXt posixt-getters |
Group date-time components | date_group.POSIXt posixt-group |
Rounding: date-time | date_ceiling.POSIXt date_floor.POSIXt date_round.POSIXt posixt-rounding |
Sequences: date-time | date_seq.POSIXt posixt-sequence |
Setters: date-time | posixt-setters set_day.POSIXt set_hour.POSIXt set_minute.POSIXt set_month.POSIXt set_second.POSIXt set_year.POSIXt |
Shifting: date and date-time | date_shift.POSIXt posixt-shifting |
Sequences: duration | seq.clock_duration |
Sequences: iso-year-week-day | seq.clock_iso_year_week_day |
Sequences: time points | seq.clock_time_point |
Sequences: year-day | seq.clock_year_day |
Sequences: year-month-day | seq.clock_year_month_day |
Sequences: year-month-weekday | seq.clock_year_month_weekday |
Sequences: year-quarter-day | seq.clock_year_quarter_day |
Sequences: year-week-day | seq.clock_year_week_day |
Info: sys-time | sys_time_info |
What is the current sys-time? | sys_time_now |
Parsing: sys-time | sys-parsing sys_time_parse sys_time_parse_RFC_3339 |
Cast a time point between precisions | time_point_cast |
Counting: time point | time_point_count_between |
Precision: time point | time_point_precision |
Shifting: time point | time_point_shift |
Spanning sequence: time points | time_point_spanning_seq |
Arithmetic: Time points | add_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 rounding | time-point-rounding time_point_ceiling time_point_floor time_point_round |
Support for vctrs arithmetic | clock-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 vector | weekday |
Extract underlying weekday codes | weekday_code |
Convert a weekday to an ordered factor | weekday_factor |
Arithmetic: weekday | add_days.clock_weekday weekday-arithmetic |
Calendar: year-day | year_day |
Calendar: year-month-day | year_month_day |
Parsing: year-month-day | year_month_day_parse |
Calendar: year-month-weekday | year_month_weekday |
Calendar: year-quarter-day | year_quarter_day |
Calendar: year-week-day | year_week_day |
Arithmetic: year-day | add_years.clock_year_day year-day-arithmetic |
Boundaries: year-day | calendar_end.clock_year_day calendar_start.clock_year_day year-day-boundary |
Counting: year-day | calendar_count_between.clock_year_day year-day-count-between |
Getters: year-day | get_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-day | calendar_group.clock_year_day year-day-group |
Narrow: year-day | calendar_narrow.clock_year_day year-day-narrow |
Setters: year-day | set_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-day | calendar_widen.clock_year_day year-day-widen |
Arithmetic: year-month-day | add_months.clock_year_month_day add_quarters.clock_year_month_day add_years.clock_year_month_day year-month-day-arithmetic |
Boundaries: year-month-day | calendar_end.clock_year_month_day calendar_start.clock_year_month_day year-month-day-boundary |
Counting: year-month-day | calendar_count_between.clock_year_month_day year-month-day-count-between |
Getters: year-month-day | get_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-day | calendar_group.clock_year_month_day year-month-day-group |
Narrow: year-month-day | calendar_narrow.clock_year_month_day year-month-day-narrow |
Setters: year-month-day | set_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-day | calendar_widen.clock_year_month_day year-month-day-widen |
Arithmetic: year-month-weekday | add_months.clock_year_month_weekday add_quarters.clock_year_month_weekday add_years.clock_year_month_weekday year-month-weekday-arithmetic |
Boundaries: year-month-weekday | calendar_end.clock_year_month_weekday calendar_start.clock_year_month_weekday year-month-weekday-boundary |
Counting: year-month-weekday | calendar_count_between.clock_year_month_weekday year-month-weekday-count-between |
Getters: year-month-weekday | get_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-weekday | calendar_group.clock_year_month_weekday year-month-weekday-group |
Narrow: year-month-weekday | calendar_narrow.clock_year_month_weekday year-month-weekday-narrow |
Setters: year-month-weekday | set_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-weekday | calendar_widen.clock_year_month_weekday year-month-weekday-widen |
Arithmetic: year-quarter-day | add_quarters.clock_year_quarter_day add_years.clock_year_quarter_day year-quarter-day-arithmetic |
Boundaries: year-quarter-day | calendar_end.clock_year_quarter_day calendar_start.clock_year_quarter_day year-quarter-day-boundary |
Counting: year-quarter-day | calendar_count_between.clock_year_quarter_day year-quarter-day-count-between |
Getters: year-quarter-day | get_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-day | calendar_group.clock_year_quarter_day year-quarter-day-group |
Narrow: year-quarter-day | calendar_narrow.clock_year_quarter_day year-quarter-day-narrow |
Setters: year-quarter-day | set_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-day | calendar_widen.clock_year_quarter_day year-quarter-day-widen |
Arithmetic: year-week-day | add_years.clock_year_week_day year-week-day-arithmetic |
Boundaries: year-week-day | calendar_end.clock_year_week_day calendar_start.clock_year_week_day year-week-day-boundary |
Counting: year-week-day | calendar_count_between.clock_year_week_day year-week-day-count-between |
Getters: year-week-day | get_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-day | calendar_group.clock_year_week_day year-week-day-group |
Narrow: year-week-day | calendar_narrow.clock_year_week_day year-week-day-narrow |
Setters: year-week-day | set_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-day | calendar_widen.clock_year_week_day year-week-day-widen |
Info: zoned-time | zoned_time_info |
What is the current zoned-time? | zoned_time_now |
Precision: zoned-time | zoned_time_precision |
Parsing: zoned-time | zoned-parsing zoned_time_parse_abbrev zoned_time_parse_complete |
Get or set the time zone | zoned-zone zoned_time_set_zone zoned_time_zone |