gpt4 book ai didi

android - 我需要与 MySQL 等效的 SQLite 来处理 unix 时间戳

转载 作者:太空宇宙 更新时间:2023-11-03 12:09:56 24 4
gpt4 key购买 nike

我在 SQLite 中使用 unix 时间戳并将它们存储为整数。我的问题是我试图根据它们的 unix 时间戳选择今天的记录,但我不知道要使用什么函数。

这是我将在 MySQL 中使用的内容:

where date_format(from_unixtime(COLUMN_DATE), '%Y-%m-%d')= date_format(now(), '%Y-%m-%d')

但是,当我尝试使用这些函数时,日志中出现错误,告诉我它们不存在于 SQLite 中。

如何为 SQLite 编写此代码?

最佳答案

SQLite 日期和时间函数记录在 http://sqlite.org/lang_datefunc.html .

你的 WHERE 子句的等价物是

WHERE date(COLUMN_DATE,'unixepoch') = date('now')

关于android - 我需要与 MySQL 等效的 SQLite 来处理 unix 时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14775012/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com