tekdudedude
Technical User
- Sep 29, 2007
- 79
Hello,
In batch files I routinely use these commands to get DATE and TIME vars
The problem I am having is that from system-to-system the locale (via the Regional & Language Options) are different which effect getting HH. The default (problem) is that I get a one digit hour. I need to always get a two digit hour (08 rather than 8 for 08:00 AM). Resetting the locale on all the systems is not an option.
How can I set the current hour to a variable (HH) so as it uses two digits reguardless of the system locale settings?
Thanks,
TD
In batch files I routinely use these commands to get DATE and TIME vars
Code:
set YYYY=%DATE:~10,4%
set MO=%DATE:~4,2%
set DD=%DATE:~7,2%
set HH=%TIME:~0,2%
set MM=%TIME:~3,2%
set SS=%TIME:~6,2%
set DOW=%DATE:~0,3%
The problem I am having is that from system-to-system the locale (via the Regional & Language Options) are different which effect getting HH. The default (problem) is that I get a one digit hour. I need to always get a two digit hour (08 rather than 8 for 08:00 AM). Resetting the locale on all the systems is not an option.
How can I set the current hour to a variable (HH) so as it uses two digits reguardless of the system locale settings?
Thanks,
TD