-1

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 

how can i convert this timestamp to datetime?

2 Answers 2

0

The timestamp you get is number of miliseconds past midnight UTC time. Date is current date.

Conversion from here is simple:

time = timestamp /1000

hours = (time / 3600)
minutes = (time / 60) - (hours * 60)
seconds = time mod 60
2
  • thanks pal. im in korea, so i have to 9 hours when i display hours. reference: meta.wikimedia.org/wiki/UTC
    – Faller
    May 4, 2011 at 1:36
  • Yes Korea is UTC+9. If I recall, there is no DST in Korea so you are set :) Just be careful to take in to account the day if it rolls into the next day (locally)
    – McKracken
    May 4, 2011 at 1:39
0

If anyone is looking for a quick way to convert date/time to timestamp and back, I just came across this chrome extension and 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.