有没有办法使用 Windows 命令获得纪元时间? [英] Is there a way to get epoch time using a Windows command?
本文介绍了有没有办法使用 Windows 命令获得纪元时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法使用 Windows 命令获取纪元时间?如果不是,可以修改date
和time
命令的输出吗?
Is there a way to get epoch time using a Windows command? If not, can the date
and time
commands output be modified?
例如 date
在 Windows 中用/等给出日期.我想得到一个没有特殊字符的输出,例如/:
For example date
in Windows gives the date with / etc. I would like to get an output that has no special characters such as / :
推荐答案
要以yyyymmdd"格式获取时间,请尝试以下操作:
To get time in the "yyyymmdd" format, try this:
for /F "tokens=2-4 delims=/ " %i in ('date /t') do echo %k%i%j
更多信息:
http://www.sprint.net.au/~terbut/usefulbox/msdoscmds.htm
你也可以这样做:
echo %date:~10,4%%date:~4,2%%date:~7,2%
这篇关于有没有办法使用 Windows 命令获得纪元时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文