如何使查询询问所有未来日期而不是今天?
我想更改 mySQL 请求以询问从今天开始数据库中的所有事件。现在它只要求仅在星期四的日期进行所有活动。这就是我所拥有的:
$query = "SELECT * FROM events WHERE date(convert_tz(StartDate,'+00:00','". $numric_time."'))='$currentDate' AND UserID='" . $_SESSION['userData']['UserID'] ."' ORDER BY StartTime"; //getting date's agendas
谢谢!
I'm wanting to change the mySQL request to ask for all events in the database from today onward. Right now it is just asking for all events only on thdays date. This is what I have:
$query = "SELECT * FROM events WHERE date(convert_tz(StartDate,'+00:00','". $numric_time."'))='$currentDate' AND UserID='" . $_SESSION['userData']['UserID'] ."' ORDER BY StartTime"; //getting date's agendas
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要时区偏移,请将查询更改为使用
CURDATE() +/- INTERVAL x HOUR
,将StartDate
包装在CONVERT_TZ
等函数中code> 导致 MySql 不在该列上使用任何索引。If you need the timezone offset, change the query to use
CURDATE() +/- INTERVAL x HOUR
, wrapping theStartDate
in a function such asCONVERT_TZ
causes MySql not to use any index on that column.