我有一个表,在 SQLite 中将日期/时间值存储为儒略日(使用 julianday() 函数)。当我阅读它们时,我似乎不知道如何将它们转换回 ISO 8601 样式字符串 (YYYY-mm-ddThh:m:ss.sss)?
最佳答案
只需将儒略日数字输入 datetime
function :
A time string can be in any of the following formats:
[...]
12. DDDDDDDDDD
[...]
Format 12 is the Julian day number expressed as a floating point value.
因此 datetime(julianday_output)
与 julianday
函数的方向相反:
sqlite> select datetime(julianday(current_timestamp)) as dt_from_jd, current_timestamp as dt;
dt_from_jd | dt
2011-09-30 14:46:52 | 2011-09-30 14:46:52
关于sqlite - SQLite 中的儒略日到 ISO 8601 字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7611825/