-1

I have a text file and it contains data of the activities of online Facebook and Twitter users i.e. PostID or userID. These IDs are represented in decimal. For example "PostID":4038363805081732322.But the problem is that there is one column where time stamp of the post is also represented in decimal format e.g "PostTimeStamp": 1413332041998.These values have time in hours But i don't have any clue of converting these values into hours. Please tell me how can I convert these values and into hours. I am using python.

Hamid
  • 15
  • 1
  • 6
  • Give us some examples of these decimal numbers and the times they represent, and maybe we can help you. Otherwise there's not enough information to go on. – Mark Ransom Sep 22 '16 at 04:59
  • @hamid, refer this link http://stackoverflow.com/a/37188257/4223191 – Saran Sep 22 '16 at 05:08
  • @Mark, The whole column contains values of same format as provided in the example above. – Hamid Sep 22 '16 at 05:20

1 Answers1

0

This is epoch time, from the python library: "time.ctime([secs])" - Convert a time expressed in seconds since the epoch to a string representing local time. If secs is not provided or None, the current time as returned by time() is used. ctime(secs) is equivalent to asctime(localtime(secs)). Locale information is not used by ctime().

So just do:

import time
time.ctime(1413332041998/1000)
>> ' Wed Oct 15 11:14:01 2014'
itza
  • 58
  • 5