Reputation: 37313
I have time stored as integer in a database
Example: 11325
means 01:13:25
i am trying to make a function to do this work
i used the following code:
Public Function GetTimeFromInt(ByVal intTime As Integer) As DateTime
Dim strTemp As String = intTime.ToString("D6")
strTemp = strTemp.Insert(4, ":").Insert(2, ":")
Dim dtResult As DateTime = Date.ParseExact(strTemp, "HH:mm:ss", New System.Globalization.CultureInfo("en-GB"), Globalization.DateTimeStyles.None)
Return dtResult
End Function
And it is working fine. But i want to now if there is a way to do this using string formatting maybe like int.ToString("nn:nn:nn")
Upvotes: 1
Views: 1938