Day positions in Time Index Periods
Return position within a ti
period, or a particular
day within the period.
dayOfPeriod(xTi = today(), tif = NULL) dayOfWeek(xTi = today()) dayOfMonth(xTi = today()) dayOfYear(xTi = today()) firstDayOf(xTi) lastDayOf(xTi) firstBusinessDayOf(xTi) lastBusinessDayOf(xTi) firstBusinessDayOfMonth(xTi) lastBusinessDayOfMonth(xTi) currentMonthDay(xTi, daynum) latestMonthDay(xTi, daynum)
xTi |
a |
tif |
a time index frequency code or name. See |
daynum |
day number in month |
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.
All of the functions except the dayOfXXXXX
return ti
objects as described in the details section above. The
dayOfXXXXX
functions return numbers.
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.
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.