Announcement

Collapse
No announcement yet.

Convert Integer to time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Convert Integer to time

    I'm almost finished with a script to monitor and control SABNZBd+ from homeseer.

    One of the last things on my to do list is the remaining time function.
    What I want to do is, divide the remaining MB's by the downloadspeed KB/s.

    The value I get is i.e. 4,123. this means 4 hours 7 minutes and 38 seconds.

    Is there an easy way (function) to convert 4,123 to 04:07:23?

    regards,

    #2
    What's the math to convert 4,123 to 4 hours 7 minutes and 38 seconds?
    💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

    Comment


      #3
      My mistake, it's 4 hours 7 minutes and 23 seconds.
      0,123th part of an hour.

      Comment


        #4
        Here's a simple script to do it:
        http://www.theproblemsite.com/progra...utes_hours.asp
        Mike____________________________________________________________ __________________
        HS3 Pro Edition 3.0.0.548, NUC i3

        HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

        Comment


          #5
          Rup,

          You could also say that I would like to convert 14843 seconds to HH:MM:SS.

          Michael,

          Thanks. That is the method I was afraid for. It's 14 lines of programming for something that I, hoped, could be done by some sort of standard function.

          Comment


            #6
            This is in c# but should be easy to convert to vb.


            TimeSpan ts = new TimeSpan(0, 0, 14843);
            Console.WriteLine("Duration = " + ts.Hours + ":" + ts.Minutes + ":" + ts.Seconds);


            VB
            Dim ts As New TimeSpan(0, 0, 14843)
            Console.WriteLine("Duration = " & ts.Hours & ":" & ts.Minutes & ":" & ts.Seconds)
            Last edited by cactsbob; September 21, 2009, 10:13 AM.

            Comment


              #7
              After all I went for Michael's approach.

              thanks all for your input.

              Comment

              Working...
              X