Utilities for Dates and Times

Utilities for handling dates and times, such as selecting particular days of the week or month, formatting timestamps as required by RSS feeds, or converting timestamp representations of other software (such as 'MATLAB' and 'Excel') to R. The package is lightweight (no dependencies, pure R implementations) and relies only on R's standard classes to represent dates and times ('Date' and 'POSIXt'); it aims to provide efficient implementations, through vectorisation and the use of R's native numeric representations of timestamps where possible.


Utilities for handling dates and times, such as selecting particular days of the week or month, formatting timestamps as required by RSS feeds, or converting timestamp representations of other software (such as 'MATLAB' and 'Excel') to R. The package is lightweight (no dependencies, pure R implementations) and relies only on R's standard classes to represent dates and times ('Date' and 'POSIXt'); it aims to provide efficient implementations, through vectorisation and the use of R's native numeric representations of timestamps where possible.

[More]

Installing the package

The latest released version is available from http://enricoschumann.net. In an R session, just type:

install.packages('datetimeutils', type = 'source',
                 repos = c('http://enricoschumann.net/R', getOption('repos')))

For the latest development version, check out the Git repository and build it. In a shell (e.g. sh or bash):

## first time: cd to directory and ...
$ git clone https://github.com/enricoschumann/datetimeutils.git

## later: cd to directory and ...
$ git pull

## build and install the package
$ R CMD build datetimeutils
$ R CMD INSTALL datetimeutils_0.1-0.tar.gz  ## adjust version number

## optionally check
$ R CMD check datetimeutils_0.1-0.tar.gz    ## adjust version number

News

v0.2-12 (2018-02-28)

o nth_day: argument 'n' may be of length greater than 1

v0.2-11 (2018-02-05)

o timegrid: argument 'excludeWeekends' was renamed to 'exclude.weekends' (for consistency with other functions, such as PMwR::plot_trading_hours)

o nth_day: argument 'period' may now also be "week" or "year"; argument 'n' may now also be numeric

v0.2-10 (2018-01-26)

o nth_day: argument 'period' may be numeric

v0.2-9 (2018-01-05)

o new functions 'year', 'month' and 'nth_day'

v0.2-8 (2017-10-11)

o minor change in example for 'timegrid' to avoid error on Solaris

v0.2-7 (2017-08-25)

o 'last_weekday' now supports arguments 'before' and 'inclusive'

v0.2-6 (2017-08-17)

o new function 'end_of_previous_year'

o fixed: the 'shift' argument in 'end_of_year' had been applied to months instead of years

v0.2-5 (2017-08-07)

o add vignette with examples

v0.2-4 (2017-07-09)

o update documentation + internal changes

v0.2-3 (2017-07-09)

o new function 'guess_datetime'

v0.2-2 (2017-06-26)

o fixed: 'timegrid' had failed when timezone was missing

v0.2-1 (2017-06-26)

o fixed: 'timegrid' had ignored the 'excludeWeekends' argument

v0.2-0 (2017-05-08)

o backward incompatible changes. for better consistency, several functions have been renamed:

  convertDate   => convert_date
  convertTZ     => convert_tz
  dayOfMonth    => "day_of_month<-"
  dayOfMonth    => day_of_month
  endOfMonth    => end_of_month
  endOfPreviousMonth => end_of_previous_month
  endOfYear     => end_of_year
  firstOfMonth  => first_of_month
  firstOfYear   => first_of_year
  isBusinessDay => is_businessday
  isLeapyear    => is_leapyear
  isWeekend     => is_weekend
  lastWeekday   => last_weekday
  nextBDay      => next_bday
  nextBusinessDay => next_businessday
  nthWeekday    => nth_weekday
  prevBDay      => prev_bday
  previousBusinessDay => previous_businessday

v0.1-5 (2016-10-04)

o add short-hands 'prevBDay' and 'nextBDay' for 'previousBusinessDay' and 'nextBusinessDay'

v0.1-4 (2016-07-07)

o fixed: 'nthWeekday' had failed in some cases

o new function 'isBusinessDay'

v0.1-3 (2016-05-11)

o new function 'convertTZ'

v0.1-2 (2016-04-29)

o new function 'firstOfYear'

v0.1-0 (2015-12-09)

o there is now a public Git repository at https://github.com/enricoschumann/datetimeutils

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("datetimeutils")

0.4-0 by Enrico Schumann, 4 months ago


http://enricoschumann.net/R/packages/datetimeutils/, https://github.com/enricoschumann/datetimeutils


Browse source code at https://github.com/cran/datetimeutils


Authors: Enrico Schumann [aut, cre] , Unicode , Inc. [dtc, cph] (source of timezone names in 'tznames')


Documentation:   PDF Manual  


GPL-3 license



Imported by PMwR, tsdb.

Suggested by NMOF.


See at CRAN