sqlite:自 1/1/1970 以来如何将 select current_timestamp 作为毫秒值
sqlite: how to select current_timestamp as millisecond value since 1/1/1970
sqlite> select typeof(date('now'));
text
sqlite> select typeof(current_time);
text
sqlite> select typeof(current_date);
text
如何select当前date/time作为自Jan/1/1970以来的毫秒整数值?
strftime() 只给你几秒:
SELECT strftime('%s', 'now') * 1000;
来自SQLite doc:
Compute the time since the unix epoch in seconds (like strftime('%s','now') except includes fractional part):
SELECT (julianday('now') - 2440587.5)*86400.0;
SELECT (julianday('now') - 2440587.5)*86400.0 * 1000;
sqlite> select typeof(date('now'));
text
sqlite> select typeof(current_time);
text
sqlite> select typeof(current_date);
text
如何select当前date/time作为自Jan/1/1970以来的毫秒整数值?
strftime() 只给你几秒:
SELECT strftime('%s', 'now') * 1000;
来自SQLite doc:
Compute the time since the unix epoch in seconds (like strftime('%s','now') except includes fractional part):
SELECT (julianday('now') - 2440587.5)*86400.0;
SELECT (julianday('now') - 2440587.5)*86400.0 * 1000;