コード例 #1
0
ファイル: Datetime.cpp プロジェクト: fasiondog/hikyuu
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;
}
コード例 #2
0
ファイル: libor.cpp プロジェクト: SePTimO7/QuantLib
 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());
 }
コード例 #3
0
ファイル: iborindex.cpp プロジェクト: FlyCatZout/QuantLib
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));
}
コード例 #4
0
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;
    }
}
コード例 #5
0
ファイル: Date.cpp プロジェクト: aJimmer/CPSC-301_Lab
// 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;
	}
}
コード例 #6
0
// 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
} 
コード例 #7
0
bool Date::isValidDate(int year, Month month, int day) {
    return isValidYear(year) && day > 0
    && day <= endOfMonth(year, month);
}