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,710 of 68,980    |
|    Herbert Kleebauer to Tom Del Rosso    |
|    Re: 24-hour format to 12-hour format usi    |
|    06 Dec 20 23:12:17    |
      From: klee@unibwm.de              On 06.12.2020 02:50, Tom Del Rosso wrote:              > of doing it all in arithmetic. But I don't see a way to avoid the IF       > that chooses am and pm.       >       > if %hr% LSS 12 (set AMPM=am) else (set AMPM=pm)              I don't think that speed matters in this case or that a solution without       an "IF" is faster, but this should do it:                     setlocal enabledelayedexpansion       set /a n=hr/12*2 & set s=ampm       set AMP=!s:~%n%,2!              --- 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