3
sqlite> select typeof(date('now'));
text
sqlite> select typeof(current_time);
text
sqlite> select typeof(current_date);
text

如何选择当前日期/时间作为自 1970 年 1 月 1 日以来毫秒的整数值?

4

2 回答 2

3

strftime()只给你几秒钟:

SELECT strftime('%s', 'now') * 1000;
于 2018-05-14T18:26:17.453 回答
1

来自SQLite 文档

以秒为单位计算自 unix 纪元以来的时间(如 strftime('%s','now') ,但包括小数部分):

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

DBFiddle 演示

于 2018-05-14T18:26:37.620 回答