I am pleased to announced lubridate 1.6.0. Lubridate is designed to make working with dates and times as pleasant as possible, and is maintained by Vitalie Spinu. You can install the latest version with:

install.packages("lubridate")

This release includes a range of bug fixes and minor improvements. Some highlights from this release include:

period("3H 2M 1S")
#> [1] "3H 2M 1S"

duration("3 hours, 2 mins, 1 secs")
#> [1] "10921s (~3.03 hours)"

# Missing numerals default to 1.
# Repeated units are summed
period("hour minute minute")
#> [1] "1H 2M 0S"

Period and duration parsing allows for arbitrary abbreviations of time units as long as the specification is unambiguous. For single letter specs, strptime() rules are followed, so m stands for months and M for minutes.

These same rules allows you to compare strings and durations/periods:

"2mins 1 sec" > period("2mins")
#> [1] TRUE
ceiling_date(ymd_hms("2016-09-12 17:10:00"), unit = "5 minutes")
#> [1] "2016-09-12 17:10:00 UTC"

That means that rounding up 2000-01-01 by a month is done to the boundary between January and February which, i.e. 2000-02-01:

ceiling_date(ymd("2000-01-01"), unit = "month")
#> [1] "2000-02-01"

This behavior is controlled by the change_on_boundary argument.

ymd_hms("2000-01-01 00:00:01") > ymd("2000-01-01")
#> [1] TRUE
yq("2016-02")
#> [1] "2016-04-01"

The new q format is available in all lubridate parsing functions.

See the release notes for the full list of changes. A big thanks goes to everyone who contributed: @arneschillert, @cderv, @ijlyttle, @jasonelaw, @jonboiser, and @krlmlr.