Results 1 to 13 of 13

Thread: Annoying Time format issue

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Annoying Time format issue

    Hi all,

    I'm working on a program right now that restarts the computer at a set time, an "automatic shutdown" sort of tool. HERE and HERE are my previous threads on my issues with it, for more info.



    My newest issue is this:

    It's currently set so that when I use the left hand portion of the program (for shuttting down with a countdown timer) it will display the time currently, and how long until shutdown (a countdown).

    When You use the right hand side of the form, it shows the time currently and at what time the specified time will be reached.

    What I'm trying to do now is make the left hand side part display not only how long left until shut-down, counting down, but also the TIME at which it will shut down. For the right hand side, I want it to display how much time is left until shut-down. Basically I want to add the alternate features to either side.


    For the left hand side, I tried to add "Time -" to the code, like so:

    ORIGINAL CODE:

    Code:
    newTime = Time
    diff = DateDiff("s", newTime, OldTime)
    TTSD.Caption = (diff \ 60) & ":" & _
            Format((diff - ((diff \ 60) * 60)), "00")
    NEW CODE:

    Code:
    newTime = Time
    diff = DateDiff("s", newTime, OldTime)
    TTSD.Caption = (diff \ 60) & ":" & _
            Format((diff - ((diff \ 60) * 60)), "00")
            
            TSD.Caption = (Time - (diff \ 60) & ":") & _
            Format((diff - ((diff \ 60) * 60)), "00")
    After I tried this, this was the result that I got (for a clock set to 1 minute in the future):



    1899? :S

    I cannot simply copy the code that I am using from the right-hand side to display the time it will shut down, since all that does it print what's in those boxes on the right, which would be wrong since it's taking the time from the section on the left.


    For the right hand side, I tried simple using code from the left to display the correct time:

    Code:
    newTime = Time
    diff = DateDiff("s", newTime, OldTime)
    TTSD.Caption = (diff \ 60) & ":" & _
            Format((diff - ((diff \ 60) * 60)), "00")
    However, when I activated the clock and timer, it came up showing this:




    As you can see, It's not so easy to just copy the code across on this program. What I'm basically asking is two things:

    1. How to take a time, and a countdown time in seconds, and add the countdown onto the "time" to produce an end-time
    (This is so that for the left hand section, I can display not just how long LEFT until shutdown, but also at what TIME it will shutdown. Just like the section on the right)

    2. What's the format for displaying one time minus another?
    (This is so that for the right hand section, I can show not just WHEN it'll shut down, but also how long LEFT until shutdown. A shutdown timer, just like on the left)

    Latest ZIP of my complete program:
    Linky Mc Link

    Thank you
    Last edited by BubbleLife; Sep 14th, 2005 at 02:13 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width