Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,704 of 68,980    |
|    Tom Del Rosso to All    |
|    24-hour format to 12-hour format using o    |
|    05 Dec 20 20:50:10    |
      From: fizzbintuesday@that-google-mail-domain.com              The last line is the thing I want to point out. It's a single equation       that converts the hour from 24-hour format to 12-hour format. I'm sure       this would run faster than an IF statement and more so if the IF was       followed by a GOTO. In the past I have used IF because I hadn't thought       of doing it all in arithmetic. But I don't see a way to avoid the IF       that chooses am and pm.              set tm=%time%       set hr=%tm:~0,2%       if %hr% LSS 12 (set AMPM=am) else (set AMPM=pm)       set /a hr=hr%%12 + !hr*12 + !(hr-12)*12              --              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca