如何在PHP MySQL中的两个日期之间选择数据 [英] How to select data between two dates in PHP MySQL

查看:112
本文介绍了如何在PHP MySQL中的两个日期之间选择数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要选择两个日期之间的数据,但是我没有使用正确的PHP,MYSQL函数来执行此步骤.

我对自己的问题有疑问.

1.我应该选择哪种格式/数据类型将日期存储在MySQL数据库中?
2.应该使用哪个PHP函数处理日期?
3.我应该在SQL查询中使用哪个MySQL函数来获取两个日期之间的精确数据.

请为我提供指导吗?


注意:如果有关在PHP/MySQL中处理日期还有其他重要的事情,请给我您宝贵的指导.

I need to select data between two dates, but I am not getting the Right PHP, MYSQL functions to perform this step.

I have some questions regarding my problem.

1. Which Format/data type should I choose to store dates in MySQL database?
2. Which PHP function should I use to handle dates?
3. Which MySQL function should I use in SQL Queries to get the precise data between two dates.

Please guide me about that?


Note: If there are some other important things about handling dates in PHP/MySQL, please give me your precious guideline.

推荐答案

您可以使用time();.看看php如何格式化日期.如果需要,可以从下面的每个代码中回显这些值,以了解其工作方式. Php有据可查,应该很容易找到

You can use time(); to see how php will format a date. You can echo out the values if you want from each of the code below to get a feel for how it works. Php is well documented, and should be very easy to find


date = time();
date = time();


day = date(''d'',
day = date(''d'',


这篇关于如何在PHP MySQL中的两个日期之间选择数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆