Make working with dates in R just that little bit easier
as_datetime()
accepts multiple formats in format argument, just like as_date()
does.ymd_hm
on locales where p
format is not defined.as_date("character")
to work correctly with formats that include extra characters.make_dateime()
when units exceed their maximal values.roll
argument to updating and time-zone manipulation functions is deprecated in favor of a new roll_dst
parameter.as_date
with character inputs accepts multiple formats in format
argument. When format
is supplied, the input string is parsed with parse_date_time
instead of the old strptime
.as.integer
method for Duration, Period and Interval classes.year<-
, month<-
etc. accessors truly generic. In order to make them work with arbitrary class XYZ, it's enough to define a reclass_date.XYZ
method.year<-
, month<-
etc. accessors for data.table
's IDate and ITime objects.week_start
argument in all lubridate functions now accepts full and abbreviated names of the days of the week.wday<-
can be a string either in English or as provided by the current locale.unit
argument for rounding to a vector of date-times.as.duration
now allows for full roundtrip duration -> as.character -> as.duration
stamp
gained new argument exact=FALSE
to indicate whether orders
argument is an exact strptime formats string or not.%within
method with signature (Interval, list), which was documented but not implemented.format_ISO8601()
gained a new option usetz="Z"
to format time zones with a "Z" and convert the time to the UTC time zone.Period
objects in rounding functions is explicitly documented.%within%
now correctly works with flipped intervalsas_datetime()
now preserves the time zone of the POSIXt input.fast_strptime()
and parse_date_time2()
now have a recycled isdst
field.train
argument in parse_date_time
now takes effect. It was previously ignored.c.POSIXct
and c.Date
on empty single POSIXct and Date vectors.POSIXct
,POSIXlt
) heterogeneous concatenation.j
now works on numeric inputs.stamp()
now correctly errors when no formats could be guessed.tzs = "UTC"
) now returns a POSIXct.lubridate
is now relying on timechange
package for update and time-zone computation. Google's CCTZ code is no longer part of the package.lubridate
's updating logic is now built on top of timechange
package.c.Period
, c.Duration
and c.Interval
from S4 to S3.fast_strptime()
and parse_date_time2()
now accept multiple formats and apply them in turn%z
formatdyears(1) == years(1)
is now TRUE
.dmonths()
to complement other duration constructors.duration()
constructor now accepts months
and years
arguments.format_ISO8601()
methods.as_date()
now ignores the tz
argumentforce_tz()
, with_tz()
, tz<-
convert dates to date-timesNA_Date_
and NA_POSIXct_
which parallel built-in primitive constants.Date()
and POSIXct()
which parallel built-in primitive constructors.as_datetime()
always returns a POSIXct()
generics
dependency package.-
.%within%
throws more meaningful messages when applied on unsupported classesfiscal_start
s.leap_year()
works with objects supported by year()
.duration()/period()/make_difftime()
work with repeated unitsc.Period
concatenation doesn't fail with empty components.exact = TRUE
argument in parse_date_time2
, which was so far ignored.%within%
now accepts a list of intervals, in which case an instant is checked if it occurs within any of the supplied intervals.%%
on intervals relies on %m+
arithmetic and doesn't produce NAs when intermediate computations result in non-existent dates.tz()
always returns "UTC" when tzone
attribute cannot be inferred.interval
constructor accepts start and end character vectors in ISO 8601 format