Hi every one!
I have an acces table viewed in datagridview and trying to add the values of column 3 and 4 (date time data types). my code is as below.
string StartTime = dataGridView1.Rows[i].Cells[3].Value.ToString();
string StartTime = dataGridView1.Rows[i].Cells[3].Value.ToString();
string Total = dataGridView1.Rows[i].Cells.Value.ToString();
MessageBox.Show(StartTime);
TimeSpan spantotal = TimeSpan.Parse(Total); //convert f into timespan and store in a
TimeSpan spanStartTime = TimeSpan.Parse(StartTime);
TimeSpan SpanEndTime = (spantotal.Add(spanStartTime));// sum of timespan a and b store in c
TimeEnd = new DateTime(SpanEndTime.Ticks);
string strTimeEnd = TimeEnd.ToString("hh:mm tt");
dataGridView1.Rows[i].Cells[4].Value = strTimeEnd; //assign c to to.value]