Skip to content

Date/time parsing

ymd() ydm() mdy() myd() dmy() dym() yq() ym() my()
Parse dates with year, month, and day components
ymd_hms() ymd_hm() ymd_h() dmy_hms() dmy_hm() dmy_h() mdy_hms() mdy_hm() mdy_h() ydm_hms() ydm_hm() ydm_h()
Parse date-times with year, month, and day, hour, minute, and second components.
ms() hm() hms()
Parse periods with hour, minute, and second components
parse_date_time() parse_date_time2() fast_strptime()
User friendly date-time parsing functions
Guess possible date-times formats from a character vector

Setting, getting, and rounding

year() `year<-`() isoyear() epiyear()
Get/set years component of a date-time
quarter() semester()
Get the fiscal quarter and semester of a date-time
month() `month<-`()
Get/set months component of a date-time
week() `week<-`() isoweek() epiweek()
Get/set weeks component of a date-time
day() mday() wday() qday() yday() `day<-`() `mday<-`() `qday<-`() `qday<-`() `wday<-`() `yday<-`()
Get/set days component of a date-time
hour() `hour<-`()
Get/set hours component of a date-time
minute() `minute<-`()
Get/set minutes component of a date-time
second() `second<-`()
Get/set seconds component of a date-time
tz() `tz<-`()
Get/set time zone component of a date-time

Date-time helpers

as_date() as_datetime()
Convert an object to a date or date-time
Cyclic encoding of date-times
date() `date<-`()
Get/set date component of a date-time
Converts a date to a decimal of its year
is.Date() Date() NA_Date_
Various date utilities
is.POSIXt() is.POSIXlt() is.POSIXct() POSIXct() NA_POSIXct_
Various POSIX utilities
is.instant() is.timepoint()
Is x a date-time object?
make_datetime() make_date()
Efficient creation of date-times from numeric representations
now() today()
The current day and time
1970-01-01 UTC


A ‘duration’ is a timespan measured in seconds.

duration() dseconds() dminutes() dhours() ddays() dweeks() dmonths() dyears() dmilliseconds() dmicroseconds() dnanoseconds() dpicoseconds() is.duration()
Create a duration object.
Is x a difftime object?
Create a difftime object.
Change an object to a duration
Duration-class durations
Duration class


A ‘period’ is a timespan defined in civil time (human) units like years, months, and days.

period() is.period() seconds() minutes() hours() days() weeks() years() milliseconds() microseconds() nanoseconds() picoseconds() months(<numeric>)
Create or parse period objects
period_to_seconds() seconds_to_period()
Contrive a period to/from a given number of seconds
Change an object to a period
Period class


An interval is a timespan defined by two date-times.

interval() `%--%` is.interval() int_start() `int_start<-`() int_end() `int_end<-`() int_length() int_flip() int_shift() int_overlaps() int_standardize() int_aligns() int_diff()
Utilities for creation and manipulation of Interval objects
Change an object to an interval
Does a date (or interval) fall within an interval?
Interval-class intervals
Interval class


Timespans are the generic concept that underlies durations, periods, and intervals.

timespan timespans
Description of time span classes in lubridate
Compute the exact length of a time span
Is x a length of time?


stamp() stamp_date() stamp_time()
Format dates and times based on human-friendly templates
Format in ISO8601 character format

Other modification functions

Changes the components of a date object
Fit a POSIXlt date-time to the timeline
Get date-time in a different time zone
force_tz() force_tzs()
Replace time zone to create new date-time
round_date() floor_date() ceiling_date()
Round, floor and ceiling methods for date-time objects
Computes attractive axis breaks for date-time data
rollbackward() rollback() rollforward()
Roll backward or forward a date the previous, current or next month
`%m+%` add_with_rollback()
Add and subtract months to a date without exceeding the last day of the new month
Get local time from a date-time vector.

Other date-time components

am() pm()
Does date time occur in the am or pm?
Get the number of days in the month of a date-time
Get daylight savings time indicator of a date-time
Is a year a leap year?
Converts a decimal to a date


Lakers 2008-2009 basketball data set