sqlite - SQLite 中的儒略日到 ISO 8601 字符串

标签 sqlite iso8601 julian-date

我有一个表,在 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/

相关文章:

r - 将日期向量转换为R中的儒略日

java - 在Android Studio中:How I can update the column data?

sql - Rails 3/SQL-一个复杂的“存在吗?”询问

datetime - spring boot Joda DateTime 序列化

java.util.Formatter : UnknownFormatConversionException: Conversion = 'F'

java - sqlite 将 Jdn 转换为 unixepoch

java - 将儒略日期转换为以毫秒为单位的时间

android - 在android中创建一个具有外键作为表列的sqlite数据库表。我面临以下错误。我该如何解决这个问题

visual-studio-2010 - 反正有从SQLite数据库生成数据库图的方法吗?

postgresql - 在 PostgreSQL 中存储 ISO 8601 持续时间