Hi guys,
Need a little help with a project of mine where I need to calculate the hour difference between two datetime values.
The issue I have is subtracting past midnight time like: (00:00:00 - 23:00:00) = 60 minutes (1 hour)
The idea behind is that I have to check a Datagridview list items if from the current time (=Now) if an hour has passed and then remove it.
My code works ok until right before the midnight change.
Thanks in advance.Code:For Each row As DataGridViewRow In dgvWashing.Rows Dim StartDate, StartTime As DateTime Dim StopDate, StopTime As DateTime StartDate = Convert.ToDateTime((row.Cells(6).Value)).ToString("dd.MM.yyyy") StartTime = Convert.ToDateTime((row.Cells(6).Value)).ToString("HH:mm:ss") StopDate = DateTime.Now.ToString("dd.MM.yyyy") StopTime = DateTime.Now.ToString("HH:mm:ss") Dim seco = (StopTime - StartTime).TotalSeconds Dim days As Integer = (StopDate.Date - StartDate.Date).Days Dim rowID = row.Cells(0).Value.ToString




Reply With Quote
