P
Peter Proost
Hi group, it's been a long time since the last time I've been here but I
have a question.
I'm working with timespan.parse for calculating a duration, I have to add
strings which are in the following format 15:36:12 ==> Hours, minutes,
seconds
but sometimes there is a string like 55:26:32 ==> which is correct cause
the production machine was busy for 55 hours, but the timespan.parse crashes
on this value because it expects 2.7:26:32. I've written the following
function to convert 55:26:32 to 2.7:26:32 but I would like to know if there
isn't a built in function for this in .net 2003
Private Function ConvertToReadableString(ByVal input As String) As String
Dim strParts(2) As String
Dim intDays As Integer
Dim intHours As Integer
strParts = input.Split(":"c)
If CInt(strParts(0)) > 24 Then
intDays = CInt(Math.Floor(CInt(strParts(0)) / 24))
intHours = CInt(strParts(0)) Mod 24
Return CStr(intDays) & "." & CStr(intHours) & ":" & strParts(1)
& ":" & strParts(2)
Else
Return input
End If
End Function
Thanks
Peter
have a question.
I'm working with timespan.parse for calculating a duration, I have to add
strings which are in the following format 15:36:12 ==> Hours, minutes,
seconds
but sometimes there is a string like 55:26:32 ==> which is correct cause
the production machine was busy for 55 hours, but the timespan.parse crashes
on this value because it expects 2.7:26:32. I've written the following
function to convert 55:26:32 to 2.7:26:32 but I would like to know if there
isn't a built in function for this in .net 2003
Private Function ConvertToReadableString(ByVal input As String) As String
Dim strParts(2) As String
Dim intDays As Integer
Dim intHours As Integer
strParts = input.Split(":"c)
If CInt(strParts(0)) > 24 Then
intDays = CInt(Math.Floor(CInt(strParts(0)) / 24))
intHours = CInt(strParts(0)) Mod 24
Return CStr(intDays) & "." & CStr(intHours) & ":" & strParts(1)
& ":" & strParts(2)
Else
Return input
End If
End Function
Thanks
Peter