Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Functions
QuantExt::DateUtilities Namespace Reference

Functions

Date lastWeekday (Weekday dayOfWeek, Month m, Year y)
 
QuantLib::Date lastWeekday (QuantLib::Weekday dayOfWeek, QuantLib::Month m, QuantLib::Year y)
 

Function Documentation

◆ lastWeekday() [1/2]

Date lastWeekday ( Weekday  dayOfWeek,
Month  m,
Year  y 
)

Definition at line 31 of file dateutilities.cpp.

31 {
32 Date endOfMonth = Date::endOfMonth(Date(1, m, y));
33 Weekday lastWeekDayOfTheMonth = endOfMonth.weekday();
34 auto lastDayOfMonth = endOfMonth.dayOfMonth();
35 if (lastWeekDayOfTheMonth >= dayOfWeek) {
36 return Date(lastDayOfMonth - (lastWeekDayOfTheMonth - dayOfWeek), m, y);
37 } else {
38 return Date(lastDayOfMonth - 7 + (dayOfWeek - lastWeekDayOfTheMonth), m, y);
39 }
40}
+ Here is the caller graph for this function:

◆ lastWeekday() [2/2]

QuantLib::Date lastWeekday ( QuantLib::Weekday  dayOfWeek,
QuantLib::Month  m,
QuantLib::Year  y 
)