Mysql查询日期≥90天 [英] Mysql Query date >= 90 days
本文介绍了Mysql查询日期≥90天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想向数据库查询日期等于或大于90天的记录。
这是我迄今为止所做的:
I want to query a database for records where the date is equal to, or greater than 90 days. This is what I have so far:
$format = 'Y-m-j G:i:s';
$date = date ( $format );
// -90 days from today
date ( $format, strtotime ( '-90 day' . $date ) );
我现在只是不确定如何构造MYSQL查询。会是这样的东西(我知道这是错误的,但我不确定要做什么):
I'm just a bit unsure now how to structure the MYSQL query. Would it be something like this (I know this is wrong but i'm unsure as to what else to do):
"SELECT * FROM recurringPayments WHERE lastpmt >= date ( $format, strtotime ( '-90 day' . $date ) ) ";
推荐答案
<?php
$d = date ( $format, strtotime ( '-90 days' ) );
mysql_query("SELECT * FROM recurringPayments WHERE lastpmt <= '$d'");
?>
假设您希望数据在90天以上。
Assuming you want data 90 days and older.
这篇关于Mysql查询日期≥90天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文