Mon, -6ren">
gpt4 book ai didi

mysql - postgres 按特定日期查询记录

转载 作者:行者123 更新时间:2023-11-30 00:55:23 25 4
gpt4 key购买 nike

正在使用 postgres..

我得到了类似于下面的列

start_time: "2013-11-30 03:51:00"

但是我有 ruby​​ 生成的日期

Date.today ->  Mon, 16 Dec 2013

如何触发当天的记录?

select * from records where start_time = ?
Record.where("start_time = ?", Date.today)

最佳答案

比较日期怎么样?

Record.where("start_time >= ? and start_time < ?", Date.today, Date.today + 1)

Date.today + 1 是第二天的开始

关于mysql - postgres 按特定日期查询记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20603206/

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