bat 批处理获取时间语法格式

bat 批处理获取时间语法格式
取年份:echo %date:~0,4% 
取月份:echo %date:~5,2% 
取日期:echo %date:~8,2% 
取星期:echo %date:~10,6% 
取小时:echo %time:~0,2% 
取分钟:echo %time:~3,2% 
取秒:echo %time:~6,2% 
取毫秒:echo %time:~9,2%
示例:
D:\>echo %date:~0,4%-%date:~5,2%-%date:~8,2%
2018-06-06
D:\>echo %time:~0,2%:%time:~3,2%:%time:~6,2%
11:22:09
D:\>echo %date:~0,4%-%date:~5,2%-%date:~8,2%-%time:~0,2%:%time:~3,2%:%time:~6,2%
2018-06-06-11:22:12
D:\>echo %date:~0,4%%date:~5,2%%date:~8,2%-%time:~0,2%:%time:~3,2%:%time:~6,2%
20180606-11:23:33
如图:
bat 批处理获取时间语法格式

上一篇:MySQL的DML常用语法格式


下一篇:web api返回格式小结