What format is the Safari History.db history_visits.visit_time in?

前端 未结 2 1837
孤独总比滥情好
孤独总比滥情好 2020-12-29 12:02

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

2条回答
  •  囚心锁ツ
    2020-12-29 12:46

    To convert the visit_time value in the history.db in an excel spread sheet, open the history.db file in a tool such as DB browser for SQLLite (Windows) and export the history_visits values to a CSV file.

    Open the CSV file and create a column where you will populate your values in human readable time adjusted to your time zone, and use the following formula convert your NSDate:

    =((((C2+978307200)/60)/60)/24)+DATE(1970,1,1)+(-5/24)
    

    In the above formula, the time value is in cell C2, and my time zone GMT-5. To adjust to your own time zone adjust the statement in the last set of parenthesis. Presently I have (-5/24) to represent GMT-5.

    When I first approached this conversion, I mistakenly assumed the time in the history.db to be epoch time, which starts at 1/1/1970, and did not understand why there was such a skew in time. Adding the required conversion factor +978307200 solved the problem.

提交回复
热议问题