HI everyone,
string enddate = dgv.CurrentRow.Cells["Date"].Value.ToString();
I have taken date from data grid view as given above. Now i need to write a update query where i need to update the enddate by 1 month and 15 days according to the condition. Therefore could you please tell me how to increment the date.
Loading
Pravin MorePosted Sep 15, 2011, 2:44 AM
Hi Ruchi ,
do this by way....
enddate=Convert.TodateTime(enddate);
enddate.AddMonths(1);
enddate.AddDays(15);
i hope this will solve ur problem.
Thanx
pravin
Pravin MorePosted Sep 15, 2011, 3:06 AM
HI try this,
String newdt=enddate.toString()
newdt = String.Format("{0:MM/dd/yy}", newdt);Thanx,
Pravin
Ruchi RPosted Sep 15, 2011, 2:52 AM
can you do me one more favor please. If i need to convert the enddate into MM-dd-yyyy format and remove the time from it. How can i do that?
Mamta MPosted Sep 15, 2011, 2:41 AM
Assuming you have converted your date from string enddate to a DateTime value dt:
dt = dt.AddMonths(1); then followed by
dt = dt.AddDays(15);