lubridate v1.6.0


Monthly downloads



Make Dealing with Dates a Little Easier

Functions to work with date-times and time-spans: fast and user friendly parsing of date-time data, extraction and updating of components of a date-time (years, months, days, hours, minutes, and seconds), algebraic manipulation on date-time and time-span objects. The 'lubridate' package has a consistent and memorable syntax that makes working with dates easy and fun.


Build Status Coverage Status CRAN RStudio mirror downloads Development version CRAN version


Date-time data can be frustrating to work with in R. R commands for date-times are generally unintuitive and change depending on the type of date-time object being used. Moreover, the methods we use with date-times must be robust to time zones, leap days, daylight savings times, and other time related quirks, and R lacks these capabilities in some situations. Lubridate makes it easier to do the things R does with date-times and possible to do the things R does not. Specifically, lubridate provides:

  • a set of intuitive date-time related functions that work the same way for all common date-time classes (including those from chron, timeDate, zoo, xts, its, tis, timeSeries, fts, and tseries)

  • quick and easy parsing of date-times: ymd(), dmy(), mdy(), ...

  • simple functions to extract and modify components of a date-time, such as years, months, days, hours, minutes, and seconds: year(), month(), day(), ...

  • helper functions for handling time zones: with_tz(), force_tz()

Lubridate also expands the type of mathematical operations that can be performed with date-time objects. It introduces three new time span classes borrowed from

  • durations, which measure the exact amount of time between two points

  • periods, which accurately track clock times despite leap years, leap seconds, and day light savings time

  • intervals, a protean summary of the time information between two points

Functions in lubridate

Name Description
date Get/set Date component of a date-time.
as.period Change an object to a period.
date_decimal Converts a decimal to a date.
guess_formats Guess formats from the supplied date-time character vector.
decimal_date Converts a date to a decimal of its year.
Duration-class Duration class
duration Create a duration object.
hidden_aliases Internal page for hidden aliases
force_tz Replace time zone to create new date-time
Deprecated-lubridate Deprecated function in lubridate package
dst Get Daylight Savings Time indicator of a date-time.
fit_to_timeline Fit a POSIXlt date-time to the timeline
days_in_month Get the number of days in the month of a date-time.
lakers Lakers 2008-2009 basketball data set
is.POSIXt Is x a POSIXct or POSIXlt object?
is.Date Is x a Date object?
ms Create a period with the specified hours, minutes, and seconds
is.difftime Is x a difftime object?
is.instant Is x a date-time object?
hour Get/set hours component of a date-time.
Interval-class Interval class
interval Utilities for creation and manipulation of Interval objects.
is.timespan Is x a length of time?
month Get/set months component of a date-time.
%m+% Add and subtract months to a date without exceeding the last day of the new month
now The current time
make_datetime Efficient creation of date-times from numeric representations
origin 1970-01-01 UTC
period_to_seconds Contrive a period to/from a given number of seconds.
leap_year Is a year a leap year?
lubridate-package Dates and times made easy with lubridate
make_difftime Create a difftime object.
minute Get/set minutes component of a date-time.
quarter Get the fiscal quarter and semester of a date-time.
reclass_date Convenience method to reclass dates post-modification.
quick_durations Quickly create duration objects.
reclass_timespan Convenience method to reclass timespans post-modification.
round_date Round, floor and ceiling methods for date-time objects.
rollback Roll back date to last day of previous month
pretty_dates Computes attractive axis breaks for date-time data
Period-class Period class
quick_periods Quickly create period objects.
period Create a period object.
Timespan-class Timespan class
%within% Tests whether a date or interval falls within an interval
tz Get/set time zone component of a date-time.
time_length Compute the exact length of a time span.
second Get/set seconds component of a date-time.
today The current date
week Get/set weeks component of a date-time.
timespan Description of time span classes in lubridate.
stamp Format dates and times based on human-friendly templates.
with_tz Get date-time in a different time zone
year Get/set years component of a date-time.
ymd_hms Parse dates that have hours, minutes, or seconds elements.
ymd Parse dates according to the order in that year, month, and day elements appear in the input vector.
as_date Convert an object to a date or date-time
DateCoercion Convert a variety of date-time classes to POSIXlt and POSIXct
day Get/set days component of a date-time.
am Does date time occur in the am or pm?
DateUpdate Changes the components of a date object
as.interval Change an object to an interval.
as.duration Change an object to a duration.
parse_date_time Parse character and numeric date-time vectors with user friendly order formats.
No Results!

Vignettes of lubridate

No Results!

Last month downloads


License GPL-2
LazyData true
Type Package
VignetteBuilder knitr
Collate 'Dates.r' 'POSIXt.r' 'util.r' 'timespans.r' 'intervals.r' 'difftimes.r' 'durations.r' 'periods.r' 'accessors-date.R' 'accessors-day.r' 'accessors-dst.r' 'accessors-hour.r' 'accessors-minute.r' 'accessors-month.r' 'accessors-quarter.r' 'accessors-second.r' 'accessors-tz.r' 'accessors-week.r' 'accessors-year.r' 'am-pm.r' 'time-zones.r' 'numeric.r' 'coercion.r' 'constants.r' 'data.r' 'decimal-dates.r' 'deprecated.r' 'guess.r' 'help.r' 'hidden.r' 'instants.r' 'leap-years.r' 'ops-addition.r' 'ops-%m+%.r' 'ops-compare.r' 'ops-division.r' 'ops-integer-division.r' 'ops-modulo.r' 'ops-multiplication.r' 'ops-subtraction.r' 'parse.r' 'pretty.r' 'round.r' 'stamp.r' 'update.r'
RoxygenNote 5.0.1
NeedsCompilation yes
Packaged 2016-09-12 17:23:27 UTC; vspinu
Repository CRAN
Date/Publication 2016-09-13 13:11:52
X-CRAN-Comment Version 1.7.0 archived on 2017-11-01 for policy violation.

Include our badge in your README