When looking at the History.db from Safari, there's a table named history_visits
which has a column named visit_time
, which is a REAL
value. It has values such as 470799793.096987
. What format is that in? I'd like to see it in a format such as 12/08/2015 05:12:05.
Steps to open Safari's browser history databaseTo activate Finder's Go to Folder command, use the keyboard shortcut of: Command-Shift-G . This also works within the Open Database dialog in DB Browser. Type in ~/Library/Safari to get to the enclosing directory of the history database. Open it with your SQLite client.
The browser history of Safari is stored in `~/Library/Safari/History. db` which is a regular SQLite database. For example, it can be viewed using SQLite Browser or queried using Python. The database contains a table named `history_items`.
Unfortunately Safari doesn't show the time. The entire browsing history available in History -> Show All History menu shows only the date. The history is saved in a database file named. db located in Safari folder inside your Library.
It is located here: /Users/[yourname]/Library/Safari/History. db . In the Browse Data Tab click the Table: dropdown and select history_visits. Now, sort by visit_time and find the thing you are interested in.
It's the number in seconds since 00:00:00 UTC on 1 January 2001. It must be coming from an NSDate
.
NSDate objects encapsulate a single point in time, independent of any particular calendrical system or time zone. Date objects are immutable, representing an invariant time interval relative to an absolute reference date (00:00:00 UTC on 1 January 2001).
— NSDate Class Reference
To get a decent human value out of it, you must add 978307200
(the epoch for 2001-01-01 00:00:00).
This query should give you what you want:
.headers on
select datetime(v.visit_time + 978307200, 'unixepoch', 'localtime') as date, v.visit_time + 978307200 as epoch, v.visit_time, i.domain_expansion, i.url
from history_items i left join history_visits v on i.id = v.history_item
order by i.id desc
limit 100;
Example output:
date|epoch|visit_time|domain_expansion|url
2015-12-31 11:51:27|1451562687.28465|473255487.284646|duckduckgo|https://duckduckgo.com/?q=current+timestamp+2015-12-31+11:51&t=osx
PS: Just for future reference, the Safari db file is located at ~/Library/Safari/History.db
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With