Dos下面取系统时间的方法


rem DOS get current time yyyy-mm-dd hhmiss week
rem =======================
rem get yyyy/mm/dd
set mydate=%DATE:~0,10%
echo %mydate%
rem =======================
rem get yyyy
set yyyy=%DATE:~0,4%
echo %yyyy%
rem =======================
rem get mm
set mm=%DATE:~5,2%
echo %mm%
rem =======================
rem get dd
set dd=%DATE:~8,2%
echo %dd%

rem =======================
rem get week ,display CN
set week=%DATE:~11,2%
rem or
set week1=%date:~-3%

echo %week% %week1%

rem or


rem =======================
rem get hour
set hh=%TIME:~0,2%
echo %hh%

rem =======================
rem get min
set mi=%TIME:~3,2%
echo %mi%

rem =======================
rem get ss
set ss=%TIME:~6,2%
echo %ss%

rem =======================
rem get yyyy-mm-dd
set curdate=%yyyy%-%mm%-%dd%_%hh%%mi%%ss%(%week%)
echo %curdate%
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值