C
C#17mo ago
yumo

❔ date difference

Quick question, why is this not giving me any result on my column resultado?
horaInicio is nvarchar(max) horaFim nvarchar(max) resultado nvarchar(max)
// get the value of the "horaInicio" column
DateTime horaInicio = (DateTime)row.Cells["horaInicio"].Value;

// get the value of the "horaFim" column
DateTime horaFim = (DateTime)row.Cells["horaFim"].Value;

// calculate the duration between the two times
TimeSpan duration = horaFim - horaInicio;

// set the value of the "resultado" column to the duration in hours
row.Cells["resultado"].Value = duration.TotalHours;
// get the value of the "horaInicio" column
DateTime horaInicio = (DateTime)row.Cells["horaInicio"].Value;

// get the value of the "horaFim" column
DateTime horaFim = (DateTime)row.Cells["horaFim"].Value;

// calculate the duration between the two times
TimeSpan duration = horaFim - horaInicio;

// set the value of the "resultado" column to the duration in hours
row.Cells["resultado"].Value = duration.TotalHours;
1 Reply
Accord
Accord17mo ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.