// Method Member: adjust the date according to modified following convection: // the date is rolled to the next business day, unless doing so you will find a date in the next calendar month, // in which case the date is rolled on the previous business day. (see http: // en.wikipedia.org/wiki/Accrued_interest public Date GetModifiedFollowing() { Date output = new Date(); DayOfWeek dayOfWeek = DateValue.DayOfWeek; if (dayOfWeek == DayOfWeek.Sunday) { if (DateValue.Month == DateValue.AddDays(1).Month) { output.DateValue = DateValue.AddDays(1); return(output); } else { output.DateValue = DateValue.AddDays(-2); return(output); } } if (dayOfWeek == DayOfWeek.Saturday) { if (DateValue.Month == DateValue.AddDays(2).Month) { output.DateValue = DateValue.AddDays(2); return(output); } else { output.DateValue = DateValue.AddDays(-1); return(output); } } return(this); }
public Date GetFollowing() { Date output = new Date(this); DayOfWeek dow = DateValue.DayOfWeek; if (dow == DayOfWeek.Sunday) { output.DateValue = DateValue.AddDays(1); return(output); } if (dow == DayOfWeek.Saturday) { output.DateValue = DateValue.AddDays(2); return(output); } return(output); }
public Date AddDays(int days) { Date output = new Date(DateValue.AddDays(days)); return(output); }
public void Decre() { var yesterday = DateValue.AddDays(-1); }