Day positions in Time Index Periods

Share:

Description

Return position within a ti period, or a particular day within the period.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12

Arguments

xTi

a ti object or something that the ti() function can turn into a ti object

tif

a time index frequency code or name. See tif.

daynum

day number in month

Details

The dayOfXXXXX functions all work the same way, returning the day number of the XXXXX that jul(xTi) falls on. For example, if today is Thursday, January 5, 2006, then dayOfWeek(), dayOfMonth() and dayOfYear() are all 5. All of these are implemented via dayOfPeriod, which converts its first argument to a Julian date (via jul(xTi)) and finds the ti with frequency tif that day falls into. It returns the day number of the period represented by that time index that the Julian date falls on.

firstDayOf and lastDayOf return a daily ti for the first or last day of the period represented by xTi. firstBusinessDayOf and lastBusinessDayOf do the same but the returned ti has business daily frequency.

firstBusinessDayOfMonth returns a business daily ti for the first business day of the month of xTi. lastBusinessDayOfMonth does the same but for the last business day of the month of xTi.

currentMonthDay returns a daily ti for the next upcoming daynum'th of the month. latestMonthDay does the same for the most recent daynum'th of the month.

currentMonday returns the daily ti for the last day of the Monday-ending week that its argument falls into. The other current{Weekday} functions work the same way.

Value

All of the functions except the dayOfXXXXX return ti objects as described in the details section above. The dayOfXXXXX functions return numbers.

Note

None of these business-day functions take account of holidays, so firstBusinessDayOfMonth(20010101), for example, returns January 1, 2001 which was actually a holiday. To see how to handle holidays, look at the holidays and nextBusinessDay help pages.

See Also

ti, tif, jul, holidays, nextBusinessDay, previousBusinessDay

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.