Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In the following code I used AddDays operator to add days. But My requirement is to deduct days from dsStartDate. Can anyone help me, please!!!
if (ddlMaintenPlan.SelectedItem.Text == "Weekly")
{
DateTime dtLastday = Convert.ToDateTime(dtpMaintenceEnd.Text.Trim());


DRLocal = DTLocal.NewRow();
DateTime dtS = Convert.ToDateTime(dtpMaintenceStart.Text.Trim());
DTLocal.Rows.Add(dtS);


while (dsStartDate <= dtLastday)
{
dsStartDate = dsStartDate.AddDays(7);
DRLocal = DTLocal.NewRow();
DTLocal.Rows.Add(dsStartDate);




DTLocal.Rows.Add(dsStartDate);
//}
}



}
Posted

1 solution

Try:
C#
dsStartDate = dsStartDate.AddDays(-7);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900