void BindDates() { for (int i=0; i<5;i++) { DateTime date=DateTime.Now.AddDays(i); Response.Write(date.ToString()); } }
//Set the Start Date DateTime dtStart = DateTime.Now.Date //Get the date 5 days greater than start date DateTime dtEnd = dtStart.AddDays(5) //Set the looping parameters DateTime dtLoop = dtStart //Apply while loop While (dtLoop < dtEnd) { //Do something with dtLoop here or Print the date value Response.Write(dtloop.ToString()); //Add one dat in the start value dtLoop = dtLoop.AddDays(1) }
protected void GenrationDate() { DateTime dtStart = DateTime.Now.Date; //Get the date 5 days greater than start date DateTime dtEnd = dtStart.AddDays(5); //Set the looping parameters DateTime dtLoop = dtStart; int i = 0; for (i = dtStart.Day; i < dtEnd.Day; i++) { //Printing the Date as short formate Response.Write(dtLoop.ToShortDateString() + "<br />"); //adding one day to date dtLoop = dtLoop.AddDays(1); } }
System.DateTime dt = new System.DateTime(2011, 9, 9); for (i = 1; i <= 5; i++) { //dt.AddDays(i) use }
DateTime Dt = DateTime.Now.Date; for (int ik = 0; ik < 5; ik++) { MessageBox.Show(Dt.AddDays(Convert.ToDouble(ik)).ToString ()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)