S
si_owen
Hi folks,
I am returning a value from a db table, which is the number of mins. I
need to convert this to hrs mins which I have done using the following
code, and also displayed it in my grid:
Dim ts As TimeSpan = TimeSpan.FromMinutes(balance)
tempItem.Cells(8).Text = (ts.Hours & ":" & ts.Minutes)
However I have a problem with the minutes, 8:04 is currently displayed
as 8.4, i am using the following code:
Dim Minstring As New StringBuilder
Dim testLength As Integer = CStr(ts.Minutes).Length
If testLength <2 Then
Dim tempMin As String = "0"
tempMin &= ts.Minutes
Minstring.Append(tempMin)
Else
Minstring.Append(ts.Minutes)
End If
!!still displays 8.4, yet this works in a similar project I have when
used exclusively on dates!!
However I also have negative numbers for this value which when
displayed looks like the following:
-1:-23 instead of - 1:23
Does anyone have any ideas on how to remove the " - " sign from mins,
and also put a " 0 " infront of the 4 in 8:4
Any help would be much appreciated,
Cheers,
Simon
I am returning a value from a db table, which is the number of mins. I
need to convert this to hrs mins which I have done using the following
code, and also displayed it in my grid:
Dim ts As TimeSpan = TimeSpan.FromMinutes(balance)
tempItem.Cells(8).Text = (ts.Hours & ":" & ts.Minutes)
However I have a problem with the minutes, 8:04 is currently displayed
as 8.4, i am using the following code:
Dim Minstring As New StringBuilder
Dim testLength As Integer = CStr(ts.Minutes).Length
If testLength <2 Then
Dim tempMin As String = "0"
tempMin &= ts.Minutes
Minstring.Append(tempMin)
Else
Minstring.Append(ts.Minutes)
End If
!!still displays 8.4, yet this works in a similar project I have when
used exclusively on dates!!
However I also have negative numbers for this value which when
displayed looks like the following:
-1:-23 instead of - 1:23
Does anyone have any ideas on how to remove the " - " sign from mins,
and also put a " 0 " infront of the 4 in 8:4
Any help would be much appreciated,
Cheers,
Simon