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,097 of 68,980    |
|    Dr J R Stockton to All    |
|    Re: Leading zero on %TIME% ?    |
|    21 Dec 17 08:09:49    |
      From: J.R.Stockton@physics.org              On Thursday, December 21, 2017 at 3:41:11 PM UTC, Zaidy036 wrote:       > > On Thursday, December 21, 2017 at 4:08:11 PM UTC+2, Dr J R Stockton wrote:       > >> Variable %TIME% gives a two-digit hour from time 10:00, but before 10:00       it gives a single digit hour preceded by a space. I can copy TIME to variable       TIM. I wish, preferably, to replace that space in TIM with a zero; otherwise,       just to remove it        from TIM. I want to always get "HH:MM:SS.ss". Windows 7 & up.       > >>       > >> How is that best done, preferably in a manner that is easy to understand       on reading it in several months time?              > The following in a batch replaces the leading blank with "0" for ECHO,        > etc.: %Time: =0%              Thanks. That seems to be an ideal answer. A test worked, code       is installed in the actual file, and I look forward to seeing       it working tomorrow morning (before 10:00)!              The space was non-acceptable because '%time% was on the       command line of another program (COLS) and the space broke       the grammar of the ' option, which needs '%time% to be a       single argument.              --         (c) John Stockton, near London, UK. Using Google, no spell-check. |        Mail: J.R.""""""""@physics.org - or as Reply-To |              --- 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