Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Chrome history date/time stamp to readable format

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 X 10.5 client machines that captures internet browsing history (required as part of my sys admin duties in a US public school). Firefox 3.x stores history in a sqlite db, and I have figured out how to get that info out using python/sqlite3. Firefox 3.x uses a conventional unixtimestamp to mark visits and that is not difficult to convert... Chrome also stores browser history in a sqlite db, but its timestamp is formatted as the number of microseconds since January, 1601. I'd like to figure this out using python, but as far as I know, the sqlite3 module doesn't support that UTC format. Is there another tool out there to convert Chrome timestamps to a human readable format?

like image 799
cit Avatar asked Feb 03 '10 17:02

cit


People also ask

Can you see the time in Chrome history?

When you view the history page any of Menu > History > History , or as CTRL> - H , or as chrome://history/ , the display shows the time ( HH:mm ) and url, grouped by day. If you perform a search, then the results show the date ( mmm, dd, yyyy ) and the url.

How do I see time and date in browser history?

According to Google, users of Google Chrome can access the program's "Settings" menu and select "History" followed by "History" to access the search history. Then, you can browse the Chrome history to view all items, locate the specific date heading, and see all the visited websites for the day under that heading.

How do I open Chrome history by date?

On the Activity controls page, scroll down and click on “Manage All Web & App Activity.” Under “Search your activity,” click on “Filter by date & Product.” You will now be shown a window listing the websites you have accessed on Chrome along with a date filter that you can set for after and before a particular date.


1 Answers

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.

like image 122
Alex Martelli Avatar answered Oct 23 '22 10:10

Alex Martelli