Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

calendar-nDay

n-th n-day Dates


Description

Computes the date for the n-th or last ocurrance of a n-day in year/month.

Usage

timeNthNdayInMonth(charvec, nday = 1, nth = 1, format = "%Y-%m-%d",
    zone = "", FinCenter = "")

timeLastNdayInMonth(charvec, nday = 1, format = "%Y-%m-%d",
    zone = "", FinCenter = "")

Arguments

charvec

a character vector of dates and times.

nday

an integer vector with entries ranging from 0 (Sunday) to 6 (Saturday).

nth

an integer vector numbering the n-th occurence.

format

the format specification of the input character vector.

zone

the time zone or financial center where the data were recorded.

FinCenter

a character with the the location of the financial center named as "continent/city".

Value

returns an object of class timeDate.

For function timeNthNdayInMonth the nth ocurrance of a n-day (nth = 1,...,5) in year, month, and for timeLastNdayInMonth the last nday in year, month will be returned.

Examples

## timeNthNdayInMonth -
   # What date is the second Monday in April 2004 ?
   timeNthNdayInMonth("2004-04-01", 1, 2)

## timeLastNdayInMonth -
   # What date has the last Tuesday in May, 1996 ?
   timeLastNdayInMonth("1996-05-01", 2)

timeDate

Rmetrics - Chronological and Calendar Objects

v3043.102
GPL (>= 2)
Authors
Diethelm Wuertz [aut], Tobias Setz [cre], Yohan Chalabi [ctb], Martin Maechler [ctb], Joe W. Byers [ctb]
Initial release
2018-02-21

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.