unix时间戳在sqlite?

前端之家收集整理的这篇文章主要介绍了unix时间戳在sqlite?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何在sqlite中获取当前时间戳? current_time,current_date,current_timestamp都返回格式化的日期,而不是长。
sqlite> insert into events (timestamp) values (current_timestamp);
sqlite> insert into events (timestamp) values (current_date);
sqlite> insert into events (timestamp) values (current_time);
sqlite> select * from events;
1|2010-09-11 23:18:38
2|2010-09-11
3|23:18:51

我想要的是:

4|23234232
docs提到这个方法
SELECT strftime('%s','now');
1284248196

而这一个包括小数部分:

SELECT (julianday('now') - 2440587.5) * 86400.0;
1284248196.65098

都代表Unix Time,1970年1月1日以来的秒数。

原文链接:https://www.f2er.com/bash/388846.html

猜你在找的Bash相关文章