开发者

How do I query for data that falls between two dates?

I have an html form to select two dates 开发者_高级运维from dropdown. Now I need to retrieve all records from a MySQL database which lie between those dates. Can anyone help me?


Provided that $startDate and $endDate are in YYYY-MM-DD format (and $startDate is date before $endDate), you would probably need a query like :

$sql = "select field1, field2, ... from yourtable where yourdatefield between $startDate and $endDate";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜