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,098 of 68,980    |
|    raymond.mccormick34@gmail.com to Dr J R Stockton    |
|    Re: Leading zero on %TIME% ?    |
|    21 Dec 17 08:01:35    |
      On Thursday, 21 December 2017 14:08:11 UTC, 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?       >        >        > --        > (c) John Stockton, near London, UK. Using GMail. |       > Mail: J.R.""""""""@physics.org - or as Reply-To, if any |              Extracted from a batch file derived from code posted by Foxidrive.       In a batch file I use WMIC to isolate the date component parts including       %hour% (1 or two digits) then re-assemble the components as desired. This       method is independent of local settings and OS.              For two-digit hour              :: Insert two leading zeros       (set hour=00%hour%)       :: Extract just the two last digits       (set hh=%hour:~-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