过滤器SQLITE UNIX TIMESTAMP数据HH:MM:SS零件

发布于 2025-01-24 11:35:47 字数 736 浏览 1 评论 0原文

我的SQLite DB中有以下记录。

      **SESSION**                     **DATETIME    **BID**    ASK**
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240126  1979.74 1979.99
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240129  1979.73 1979.97
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240129  1979.73 1979.92
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240129  1979.7  1979.92
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240130  1979.68 1979.91
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240130  1979.68 1979.89

我的目标是从DateTime字段中提取HH:MM:SS时间并进行过滤。看起来应该认为,

SELECT * from table where strftime('%H:%M:%S',Datetime) < '00:02:05'

此查询的问题是它不起作用。

有没有办法从UNIX时间提取零件并将其与我的自定义零件进行比较?

I have the following records in my SQlite DB.

      **SESSION**                     **DATETIME    **BID**    ASK**
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240126  1979.74 1979.99
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240129  1979.73 1979.97
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240129  1979.73 1979.92
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240129  1979.7  1979.92
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240130  1979.68 1979.91
25e309b5-eecd-49f7-a1e4-0a77d4804978    1650240130  1979.68 1979.89

My goal is to extract the hh:mm:ss time from the DATETIME field and to filter it. It should look some think like that

SELECT * from table where strftime('%H:%M:%S',Datetime) < '00:02:05'

The problem with this query is that it's not working.

Is there a way to extract the part from the unix time and compare it to my custom one ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

故事与诗 2025-01-31 11:35:47

您需要使用'Unixepoch'修改器:

SELECT * 
FROM tablename 
WHERE time(DATETIME, 'unixepoch') < '00:02:05';

You need the function time() with the 'unixepoch' modifier:

SELECT * 
FROM tablename 
WHERE time(DATETIME, 'unixepoch') < '00:02:05';
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文