sqlite – Safari History.db history_visits.visit_time的格式是什么?

前端之家收集整理的这篇文章主要介绍了sqlite – Safari History.db history_visits.visit_time的格式是什么?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
从Safari查看History.db时,有一个名为history_visits的表,其中有一个名为visit_time的列,它是一个REAL值.它的值如470799793.096987.那是什么格式?我希望以12/08/2015 05:12:05的格式看到它.
它是自2001年1月1日00:00:00 UTC以来的秒数.它必须来自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).

— 07000

要获得合适的人类价值,您必须添加978307200(2001-01-01 00:00:00的纪元).

查询应该为您提供所需内容

.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

原文链接:https://www.f2er.com/sqlite/197909.html

猜你在找的Sqlite相关文章