Skip to content

High Level API

This section contains the high level API for R’s native date and date-time types (Date, POSIXct, and POSIXlt). For most clock users, these are the only functions you’ll need.

Construction

date_build()
Building: date
date_time_build()
Building: date-time
date_today() date_now()
Current date and date-time

Manipulation

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_spanning_seq()
Spanning sequence: date and date-time
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?
date_time_zone() date_time_set_zone()
Get or set the time zone
date_time_info()
Info: date-time

Getters and setters

Parsing and formatting

Arithmetic

Conversion

as_date()
Convert to a date
as_date_time()
Convert to a date-time

Calendars

This section contains the overarching calendar_*() API that applies to all calendars. See the subsections for details about a specific calendar.

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_spanning_seq()
Spanning sequence: calendars
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

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

Year-week-day

ISO-year-week-day

Year-quarter-day

Year-day

Invalid dates

Durations

Time points

Manipulation

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?
as_zoned_time(<clock_sys_time>)
Convert to a zoned-time from a 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
as_zoned_time(<clock_naive_time>)
Convert to a zoned-time from a naive-time

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
zoned_time_info()
Info: 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

Generics and methods

This section contains documentation about generics and methods that is already exposed elsewhere on this reference page.

Reexports

reexports tzdb_names tzdb_version
Objects exported from other packages