Skip to content

High Level API

This section contains the high level API for usage with R’s native date and date-time types, Date, POSIXct, and POSIXlt. If you are new to clock, this is the best place to start.

date_build()
Building: date
date_time_build()
Building: date-time
date_today() date_now()
Current date and date-time
date_group()
Group date and date-time components
date_count_between()
Counting: date and date-time
date_start() date_end()
Boundaries: date and date-time
date_floor() date_ceiling() date_round()
Date and date-time rounding
date_shift()
Shifting: date and date-time
date_seq()
Sequences: date and date-time
date_format()
Formatting: date and date-time
date_parse()
Parsing: date
date_time_parse() date_time_parse_complete() date_time_parse_abbrev() date_time_parse_RFC_3339()
Parsing: date-time
date_zone() date_set_zone()
Get or set the time zone
date_weekday_factor()
Convert a date or date-time to a weekday factor
date_month_factor()
Convert a date or date-time to an ordered factor of month names
date_leap_year()
Is the year a leap year?
as_date()
Convert to a date
as_date_time()
Convert to a date-time
get_year(<Date>) get_month(<Date>) get_day(<Date>)
Getters: date
get_year(<POSIXt>) get_month(<POSIXt>) get_day(<POSIXt>) get_hour(<POSIXt>) get_minute(<POSIXt>) get_second(<POSIXt>)
Getters: date-time
set_year(<Date>) set_month(<Date>) set_day(<Date>)
Setters: date
set_year(<POSIXt>) set_month(<POSIXt>) set_day(<POSIXt>) set_hour(<POSIXt>) set_minute(<POSIXt>) set_second(<POSIXt>)
Setters: date-time
add_years(<Date>) add_quarters(<Date>) add_months(<Date>) add_weeks(<Date>) add_days(<Date>)
Arithmetic: date
add_years(<POSIXt>) add_quarters(<POSIXt>) add_months(<POSIXt>) add_weeks(<POSIXt>) add_days(<POSIXt>) add_hours(<POSIXt>) add_minutes(<POSIXt>) add_seconds(<POSIXt>)
Arithmetic: date-time

Arithmetic

Calendars

calendar_group()
Group calendar components
calendar_count_between()
Counting: calendars
calendar_start() calendar_end()
Boundaries: calendars
calendar_narrow()
Narrow a calendar to a less precise precision
calendar_widen()
Widen a calendar to a more precise precision
calendar_precision()
Precision: calendar
calendar_leap_year()
Is the calendar year a leap year?
calendar_month_factor()
Convert a calendar to an ordered factor of month names
get_year() get_quarter() get_month() get_week() get_day() get_hour() get_minute() get_second() get_millisecond() get_microsecond() get_nanosecond() get_index()
Calendar getters
set_year() set_quarter() set_month() set_week() set_day() set_hour() set_minute() set_second() set_millisecond() set_microsecond() set_nanosecond() set_index()
Calendar setters

Year-month-day

Year-month-weekday

year_month_weekday()
Calendar: year-month-weekday
as_year_month_weekday()
Convert to year-month-weekday
is_year_month_weekday()
Is x a year-month-weekday?
calendar_group(<clock_year_month_weekday>)
Grouping: year-month-weekday
calendar_count_between(<clock_year_month_weekday>)
Counting: year-month-weekday
calendar_start(<clock_year_month_weekday>) calendar_end(<clock_year_month_weekday>)
Boundaries: year-month-weekday
calendar_narrow(<clock_year_month_weekday>)
Narrow: year-month-weekday
calendar_widen(<clock_year_month_weekday>)
Widen: year-month-weekday
seq(<clock_year_month_weekday>)
Sequences: year-month-weekday
add_years(<clock_year_month_weekday>) add_quarters(<clock_year_month_weekday>) add_months(<clock_year_month_weekday>)
Arithmetic: year-month-weekday
get_year(<clock_year_month_weekday>) get_month(<clock_year_month_weekday>) get_day(<clock_year_month_weekday>) get_index(<clock_year_month_weekday>) get_hour(<clock_year_month_weekday>) get_minute(<clock_year_month_weekday>) get_second(<clock_year_month_weekday>) get_millisecond(<clock_year_month_weekday>) get_microsecond(<clock_year_month_weekday>) get_nanosecond(<clock_year_month_weekday>)
Getters: year-month-weekday
set_year(<clock_year_month_weekday>) set_month(<clock_year_month_weekday>) set_day(<clock_year_month_weekday>) set_index(<clock_year_month_weekday>) set_hour(<clock_year_month_weekday>) set_minute(<clock_year_month_weekday>) set_second(<clock_year_month_weekday>) set_millisecond(<clock_year_month_weekday>) set_microsecond(<clock_year_month_weekday>) set_nanosecond(<clock_year_month_weekday>)
Setters: year-month-weekday

ISO-year-week-day

Year-quarter-day

Year-day

Invalid dates

Durations

Time points

Sys-time

as_sys_time()
Convert to a sys-time
is_sys_time()
Is x a sys-time?
sys_time_parse() sys_time_parse_RFC_3339()
Parsing: sys-time
sys_time_info()
Info: sys-time
sys_time_now()
What is the current sys-time?

Naive-time

as_naive_time()
Convert to a naive-time
is_naive_time()
Is x a naive-time?
naive_time_parse()
Parsing: naive-time
naive_time_info()
Info: naive-time

Manipulation

Zoned-time

as_zoned_time()
Convert to a zoned-time
is_zoned_time()
Is x a zoned-time?
zoned_time_parse_complete() zoned_time_parse_abbrev()
Parsing: zoned-time
zoned_time_now()
What is the current zoned-time?
zoned_time_zone() zoned_time_set_zone()
Get or set the time zone
zoned_time_precision()
Precision: zoned-time
format(<clock_zoned_time>)
Formatting: zoned-time

Weekdays

weekday()
Construct a weekday vector
as_weekday()
Convert to a weekday
is_weekday()
Is x a weekday?
weekday_code()
Extract underlying weekday codes
weekday_factor()
Convert a weekday to an ordered factor
add_days(<clock_weekday>)
Arithmetic: weekday

Locale

clock_locale()
Create a clock locale
clock_labels() clock_labels_lookup() clock_labels_languages()
Create or retrieve date related labels

Codes

Developer

Methods

date_group(<Date>)
Group date components
date_group(<POSIXt>)
Group date-time components
date_count_between(<Date>)
Counting: date
date_count_between(<POSIXt>)
Counting: date-times
date_start(<Date>) date_end(<Date>)
Boundaries: date
date_start(<POSIXt>) date_end(<POSIXt>)
Boundaries: date-time
date_format(<Date>)
Formatting: date
date_format(<POSIXt>)
Formatting: date-time
date_floor(<Date>) date_ceiling(<Date>) date_round(<Date>)
Rounding: date
date_floor(<POSIXt>) date_ceiling(<POSIXt>) date_round(<POSIXt>)
Rounding: date-time
date_shift(<Date>)
Shifting: date
date_shift(<POSIXt>)
Shifting: date and date-time
date_seq(<Date>)
Sequences: date
date_seq(<POSIXt>)
Sequences: date-time
as_zoned_time(<Date>)
Convert to a zoned-time from a date
as_zoned_time(<POSIXt>)
Convert to a zoned-time from a date-time

Reexports

reexports tzdb_names tzdb_version
Objects exported from other packages