Convert Chrome history date/time stamp to readable format

前端 未结 1 426
孤街浪徒
孤街浪徒 2020-12-20 14:41

I originally posted this question looking for an answer with using python, got some good help, but have still not been able to find a solution. I have a script running on OS

相关标签:
1条回答
  • 2020-12-20 15:29

    Use the datetime module. For example, if the number of microseconds in questions is 10**16:

    >>> datetime.datetime(1601, 1, 1) + datetime.timedelta(microseconds=1e16)
    datetime.datetime(1917, 11, 21, 17, 46, 40)
    >>> _.isoformat()
    '1917-11-21T17:46:40'
    

    this tells you it was just past a quarter to 6pm of November 21, 1917. You can format datetime objects in any way you want thanks to their strftime method, of course. If you also need to apply timezones (other than the UTC you start with), look at third-party module pytz.

    0 讨论(0)
提交回复
热议问题