System.Globalization.Calendar.AddMonths C# (CSharp) Method

AddMonths() public abstract method

public abstract AddMonths ( DateTime time, int months ) : DateTime
time DateTime
months int
return DateTime
        public abstract DateTime AddMonths(DateTime time, int months);

Usage Example

Esempio n. 1
0
        //Creates a title block. No customization is offered, if that's needed then specify the header template.
        Control CreateStaticTitle(DateTime visibleDate, System.Globalization.Calendar threadCalendar)
        {
            //Create a new table for the header controls

            Table titleTable = new Table();

            titleTable.GridLines   = GridLines.None;
            titleTable.Width       = Unit.Percentage(100);
            titleTable.CellSpacing = 0;

            TableRow titleTableRow = new TableRow();

            titleTable.Rows.Add(titleTableRow);

            TableCell PrevCell = new TableCell();

            titleTableRow.Cells.Add(PrevCell);
            PrevCell.ApplyStyle(nextPrevStyle);
            Button PrevBtn = new Button();

            PrevBtn.CssClass    = "buttonlink";
            PrevBtn.Text        = "< " + threadCalendar.AddMonths(visibleDate, -1).ToString("MMMM");
            PrevBtn.CommandName = COMMAND_PREVMONTH;
            PrevCell.Controls.Add(PrevBtn);

            TableCell MonthCell = new TableCell();

            titleTableRow.Cells.Add(MonthCell);
            MonthCell.ApplyStyle(titleStyle);
            MonthCell.Text = visibleDate.ToString("MMMM yyyy");

            TableCell NextCell = new TableCell();

            titleTableRow.Cells.Add(NextCell);
            NextCell.ApplyStyle(nextPrevStyle);
            Button NextBtn = new Button();

            NextBtn.CssClass    = "buttonlink";
            NextBtn.Text        = threadCalendar.AddMonths(visibleDate, +1).ToString("MMMM") + " >";
            NextBtn.CommandName = COMMAND_NEXTMONTH;
            NextCell.Controls.Add(NextBtn);

            return(titleTable);
        }
All Usage Examples Of System.Globalization.Calendar::AddMonths