How can I go iterating the time of a DateTime.
DateTime horaseleccionada = Convert.ToDateTime("10:00:00");
DateTime horactual = horaseleccionada;
for (int i = 0; i < llegada.Length; i++)
{
DateTime horaconvertida = horactual.AddMinutes(llegada[i]);
dataGridView1.Rows[i].Cells[2].Value = horaconvertida.ToString("HH:mm:ss");
horaseleccionada = horaconvertida;
}
The first time the time has a value of 10:00:00
but once it enters the array this adds 30 minutes which is equal to 10:30:00
.
I need to know how I can make the value of horaseleccionada
now be 10:30:00
.
I hope you have given me to understand, thank you very much.