HandCoded.Finance.Date.PlusDays C# (CSharp) Method

PlusDays() public method

Creates a new Date based in the current instance and a given number of days adjustment.
public PlusDays ( int days ) : Date
days int The number of days to adjust by.
return Date
        public Date PlusDays(int days)
        {
            return (new Date (dateValue.PlusDays (days), timeZone));
        }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Adjusts dates which fall on a Saturday to the preceding Friday, and
        /// those falling on a Sunday to the following Monday. This convention
        /// is used by some national holidays, for example Christmas Day in the
        /// USA.
        /// </summary>
        /// <param name="calendar">The <see cref="Calendar"/> to be used.</param>
        /// <param name="date">The <see cref="Date"/> to adjust.</param>
        /// <returns>A (possibly) adjusted <see cref="Date"/> instance.</returns>
        private static Date Weekend(Calendar calendar, Date date)
        {
            switch (date.Weekday)
            {
            case Date.SATURDAY:             return(date.PlusDays(-1));

            case Date.SUNDAY:               return(date.PlusDays(+1));
            }
            return(date);
        }
All Usage Examples Of HandCoded.Finance.Date::PlusDays