Safari History.db history_visits.visit_time的格式是什么? [英] What format is the Safari History.db history_visits.visit_time in?
问题描述
从Safari查看History.db时,有一个名为 history_visits
的表,该表具有名为 visit_time
的列,这是 REAL
的值。它具有诸如 470799793.096987
的值。那是什么格式?我希望以12/08/2015 05:12:05这样的格式查看它。
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.
推荐答案
自2001年1月1日00:00:00 UTC以来的秒数。它必须来自 NSDate
。
It's the number in seconds since 00:00:00 UTC on 1 January 2001. It must be coming from an NSDate
.
NSDate对象封装单个时间点,独立于任何特定的日历系统或时区。日期对象是不可变的,代表相对于绝对参考日期的不变时间间隔(2001年1月1日世界标准时间00:00:00)。
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).
要从中获得体面的人类价值,您必须添加 978307200
(2001-01-01 00:00的时代) :00)。
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;
示例输出:
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:仅用于将来的参考资料,Safari的db文件位于〜/ Library / Safari / History.db
这篇关于Safari History.db history_visits.visit_time的格式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!