I have made the following small function to convert a number of sconds supplied to it as an integer, and return a string in a "hh:mm:ss" format. Just wondering if there is a better way to do it with some sort of built in 'Format' instruction? Also, not sure if the 'Mod' operator is a framework instruction?
VB Code:
  1. Function ConvertToTime(ByVal intNum As Integer) As String
  2.  
  3.         'Convert an integer to a time string "hh:mm:ss"
  4.  
  5.         Dim h As String
  6.         Dim m As String
  7.         Dim s As String
  8.  
  9.         Dim x As String
  10.  
  11.         h = CInt(intNum / 3600).ToString                 'Calculate hours
  12.         m = CInt((intNum Mod 3600) / 60).ToString        'Calculate minutes
  13.         s = CInt(((intNum Mod 3600) Mod 60)).ToString    'Calculate seconds
  14.  
  15.         If h.Length = 1 Then h = "0" & h
  16.         If m.Length = 1 Then m = "0" & m
  17.         If s.Length = 1 Then s = "0" & s
  18.  
  19.         x = h & ":" & m & ":" & s
  20.  
  21.         Return x
  22.  
  23.     End Function
Thanks for taking a look.