i have a batch process in which i need to print IST time and GMT time in log. Can you please suggest how to achive this. I am using %date% and %time% as of now to print system date and my system is in IST.
Thanks in Advance.
i have a batch process in which i need to print IST time and GMT time in log. Can you please suggest how to achive this. I am using %date% and %time% as of now to print system date and my system is in IST.
Thanks in Advance.
Please give me the code you are using. That would help me better. But you may be able to use this code:
@echo off
cls
echo Universal Time Coordinated:
echo.
powershell "[DateTime]::UtcNow.ToString('MM/dd/yyyy HH:mm:ss')"
echo _______________________________________________________
echo.
tzutil /g
echo :
echo.
powershell "Get-Date -Format 'MM/dd/yyyy HH:mm:ss'"
pause>nul
and the more prefered:
@echo off
color f0
:time
cls
echo Universal Time Coordinated:
echo.
powershell "[DateTime]::UtcNow.ToString('MM/dd/yyyy HH:mm:ss')"
echo _______________________________________________________
echo.
tzutil /g
echo :
echo.
powershell "Get-Date -Format 'MM/dd/yyyy HH:mm:ss'"
timeout /t 1 /nobreak>nul
cls
goto time
Which refresh's the time every second.
You can use tzutil /g
to display the current timezone. For more info or for help read the following:
Windows Time Zone Utility
Usage:
TZUTIL </? | /g | /s TimeZoneID[_dstoff] | /l>
Parameters:
/? Displays usage information.
/g Displays the current time zone ID.
/s TimeZoneID[_dstoff]
Sets the current time zone using the specified time zone ID.
The _dstoff suffix disables Daylight Saving Time adjustments
for the time zone (where applicable).
/l Lists all valid time zone IDs and display names. The output will
be:
<display name>
<time zone ID>
Examples:
TZUTIL /g
TZUTIL /s "Pacific Standard Time"
TZUTIL /s "Pacific Standard Time_dstoff"
Remarks:
An exit code of 0 indicates the command completed successfully.
You can also use powershell get-date
to find your current date and time.
You can use powershell