码迷,mamicode.com
首页 > 其他好文 > 详细

获取UTC+0时间的批处理

时间:2020-02-08 18:06:00      阅读:85      评论:0      收藏:0      [点我收藏+]

标签:call   use   set   div   ctime   nbsp   color   pat   cond   

@echo off

call :getUTCTime
echo %UTCTIMESTR%

exit /b

:getUTCTime
FOR /F "usebackq tokens=1,2 delims==" %%i IN (`wmic path win32_utctime get /format:list^|find "="`) DO (
  if "%%i" EQU "Year" set YY=%%j
  if "%%i" EQU "Month" set MM=%%j
  if "%%i" EQU "Day" set DD=%%j
  if "%%i" EQU "Hour" set HH=%%j
  if "%%i" EQU "Minute" set MI=%%j
  if "%%i" EQU "Second" set SS=%%j
  if "%%i" EQU "DayOfWeek" set DW=%%j
)
if %MM% LSS 10 set MM=0%MM%
if %DD% LSS 10 set DD=0%DD%
if %HH% LSS 10 set HH=0%HH%
if %MI% LSS 10 set MI=0%MI%
if %SS% LSS 10 set SS=0%SS%

if "%DW%" EQU "1" set DWS=MON
if "%DW%" EQU "2" set DWS=TUE
if "%DW%" EQU "3" set DWS=WED
if "%DW%" EQU "4" set DWS=THU
if "%DW%" EQU "5" set DWS=FRI
if "%DW%" EQU "6" set DWS=SAT
if "%DW%" EQU "7" set DWS=SUN

set UTCDATE=%YY%-%MM%-%DD%
set UTCTIME=%HH%.%MI%.%SS%
set UTCTIMESTR=%UTCDATE%_%UTCTIME%_%DWS%_UTC0
exit /b

 

获取UTC+0时间的批处理

标签:call   use   set   div   ctime   nbsp   color   pat   cond   

原文地址:https://www.cnblogs.com/nlsoft/p/12283823.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!