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

Author Topic: Using SET and time in batch file, want to get the difference in time  (Read 34099 times)

0 Members and 1 Guest are viewing this topic.

levidos

  • Guest
Re: Using SET and time in batch file, want to get the difference in time
« Reply #15 on: March 11, 2011, 09:47:53 AM »
Check out this ultimate script that queries system time through WMI.
Link Removed...[/i]
« Last Edit: February 02, 2012, 06:25:12 PM by patio »

Migxi



    Newbie

    • Experience: Beginner
    • OS: Unknown
    Re: Using SET and time in batch file, want to get the difference in time
    « Reply #16 on: February 02, 2012, 06:15:33 PM »
    Beware of the confusion Octal/Decimal if the variable is 08 or 09

    So modification needed...

    set T1=%TIME%
    echo Start time= %T1%
    set HH=%T1:~0,2%
    set MM=%T1:~3,2%
    set SS=%T1:~6,2%
    Rem To remove confusion Octal/Decinal with 08 and 09
    IF %T1:~0,1%==0 set HH=%T1:~1,1%
    IF %T1:~3,1%==0 set MM=%T1:~4,1%
    IF %T1:~6,1%==0 set SS=%T1:~7,1%

    Envoy

    Squashman



      Specialist
    • Thanked: 121
    • Experience: Experienced
    • OS: Other
    Re: Using SET and time in batch file, want to get the difference in time
    « Reply #17 on: February 02, 2012, 08:04:52 PM »
    Beware of the confusion Octal/Decimal if the variable is 08 or 09
    Love it when people dig up old threads.
    Your statement is clearly defined in the help for the SET command.
    Quote
    Numeric values are decimal numbers, unless
    prefixed by 0x for hexadecimal numbers, and 0 for octal numbers.
    So 0x12 is the same as 18 is the same as 022. Please note that the octal
    notation can be confusing: 08 and 09 are not valid numbers because 8 and
    9 are not valid octal digits.