代码之家  ›  专栏  ›  技术社区  ›  Will Marcouiller

SQLite-当前的时间戳不返回正确的时间?

  •  0
  • Will Marcouiller  · 技术社区  · 15 年前

    在SQLite IDE SQL窗口中,我编写了返回.NET等效值的指令 DateTime.Now ,即 CURRENT_TIMESTAMP .

    假设它是当地时间的10:47:00,即GMT-4:00(在夏季),否则它是GMT-5:00。

    我的查询结果:

    select current_timestamp
    

    退货 2010-09-23 14:47:00 ,不管我的本地机器时间。

    如何使SQLite使用本地时间而不是GMT?

    谢谢大家!=)

    1 回复  |  直到 15 年前
        1
  •  3
  •   rickythefox    15 年前

    使用 select datetime(current_timestamp, 'localtime');

    您可以获得有关日期/时间函数的更多信息 here