Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: need help (time in sec)  (Read 2178 times)

0 Members and 1 Guest are viewing this topic.

dakota

  • Guest
need help (time in sec)
« on: May 09, 2006, 10:39:14 PM »
i need a code that will set a ver (tsec) that when used it will only display the seconds of the time. Think you  ;D ;D
PLAESE HELP

CameronY



    Intermediate

    Re: need help (time in sec)
    « Reply #1 on: May 10, 2006, 09:43:23 PM »
    Displays the current time's seconds value:

    echo %time:~6,2%

    so...

    set tsec=%time:~6,2%

    dakota

    • Guest
    Re: need help (time in sec)
    « Reply #2 on: May 10, 2006, 11:57:52 PM »
    so then why is this not working
     :-? :-? :-?
    Code: [Select]
    @echo off
    echo Done!!!
    set timed=%time:~6,2%
    set tsec=%timed% + "5"
    :loop
    IF %time:~6,2% EQU %tsec% (
    goto :end
    ) ELSE (
    goto :loop
    )
    :end

    CameronY



      Intermediate

      Re: need help (time in sec)
      « Reply #3 on: May 11, 2006, 12:12:44 AM »
      try ...

      @echo off
      echo Done!!!
      sleep 5


      What you were trying to do had little point and would have chewed CPU cycles for no reason.

      And, the statement ...

      set tsec=%timed% + "5"

      should have read ...

      set /a tsec=%timed% + 5

      Can only suggest that you read up more on the set command (set /?) and on some basic programming constructs.

      Hope that helps.

      dakota

      • Guest
      Re: need help (time in sec)
      « Reply #4 on: May 11, 2006, 07:25:56 AM »
      ok think you ;D