【问题标题】:sqlite3 strftime not returning anythingsqlite3 strftime没有返回任何东西
【发布时间】:2019-04-22 04:19:08
【问题描述】:

我正在使用 sqlite 3 将存储为“2018-06-03 20:11:53.784 UTC”这样的文本的日期转换为“2018-06-03”

我尝试过: select updated_at, strftime('%Y-%m-%d', updated_at) from table_1;

其中 updated_at 具有上述格式,“2018-06-03 20:11:53.784 UTC”

但是,作为回报,我只得到一列 updated_at 和一个逗号。这就对了。 strftime('%Y-%m-%d', updated_at) 部分没有返回任何内容。

我认为 strftime 不理解当前格式。任何事情都会有所帮助。谢谢!

【问题讨论】:

    标签: sql sqlite strftime


    【解决方案1】:

    我想通了。通过将文本中的“UTC”部分替换为“”来更新表格。在这一步之后,strftime 应该将文本识别为日期。

    【讨论】:

      猜你喜欢
      • 2015-02-11
      • 2012-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-17
      • 1970-01-01
      • 2014-04-28
      • 2011-05-04
      相关资源
      最近更新 更多