如何将 windows ping -s 选项上的时间戳转换为日期?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5877371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to convert timestamp on windows ping -s option to date?
提问by Faller
ping [SomeIP] -s 4-t > ping.log
ping [SomeIP] -s 4-t > ping.log
result of that command is like below.
该命令的结果如下所示。
Reply from [SomeIP] : bytes=32 time=4ms TTL=125
Timestamp: [HOP] : 83842793 ->
[HOP] : 83842793 -> [HOP] : 83832797 -> [HOP] : 83842793
[SomeIP]的回复:bytes=32 time=4ms TTL=125
时间戳:[HOP]:83842793 ->
[HOP] : 83842793 -> [HOP] : 83832797 -> [HOP] : 83842793
how can i convert this timestamp to datetime?
如何将此时间戳转换为日期时间?
回答by McKracken
The timestamp you get is number of miliseconds past midnight UTC time. Date is current date.
您获得的时间戳是 UTC 时间午夜后的毫秒数。日期是当前日期。
Conversion from here is simple:
从这里转换很简单:
time = timestamp /1000
hours = (time / 3600)
minutes = (time / 60) - (hours * 60)
seconds = time mod 60
回答by tutuDajuju
If anyone is looking for a quick way to convert date/time to timestamp and back, I just came across this chrome extensionand I think it's really great! It's the quickest cross platform method and I use it constantly since it parses plenty of date formats and is really fun nice to use.
如果有人正在寻找一种将日期/时间转换为时间戳并返回的快速方法,我刚刚遇到了这个 chrome 扩展,我认为它真的很棒!这是最快的跨平台方法,我经常使用它,因为它可以解析大量日期格式,而且使用起来非常有趣。