Datetime Datetime::nextMonth() const { Datetime result; if (*this == Null<Datetime>()) return result; result = endOfMonth().date() + bd::date_duration(1); if (result > Datetime::max()) result = Datetime::max(); return result; }
Date Libor::maturityDate(const Date& valueDate) const { // Where a deposit is made on the final business day of a // particular calendar month, the maturity of the deposit shall // be on the final business day of the month in which it matures // (not the corresponding date in the month of maturity). Or in // other words, in line with market convention, BBA LIBOR rates // are dealt on an end-end basis. For instance a one month // deposit for value 28th February would mature on 31st March, // not the 28th of March. return jointCalendar_.advance(valueDate, tenor_, convention_, endOfMonth()); }
boost::shared_ptr<IborIndex> IborIndex::clone( const Handle<YieldTermStructure>& h) const { return boost::shared_ptr<IborIndex>( new IborIndex(familyName(), tenor(), fixingDays(), currency(), fixingCalendar(), businessDayConvention(), endOfMonth(), dayCounter(), h)); }
void Date::nextDay() { if (day == endOfMonth(year, month)) { day = 1; ++month; if (month == jan) { ++year; if (!isValidYear(year)) throw std::out_of_range("last year"); } } else { ++day; } }
// Function to help increment the date void Date::helpIncrement() { if (!endOfMonth()) { // date is not at the end of the month day++; } else if (month < 12) { // date is at the end of the month, but month < 12 day = 1; ++month; } else // end of month and year: last day of the year { day = 1; month = 1; ++year; } }
// function to help increment the date void Date::helpIncrement() { // day is not end of month if (!endOfMonth(day)) day++; // increment day else if (month < 12) // day is end of month and month < 12 { ++month; // increment month day = 1; // first day of new month } // end if else // last day of year { ++year; // increment year month = 1; // first month of new year day = 1; // first day of new month } // end else }
bool Date::isValidDate(int year, Month month, int day) { return isValidYear(year) && day > 0 && day <= endOfMonth(year, month); }