When writing a query statement today, You need to determine whether the end date is greater than the current date. Generally, you can use php to determine the date and then query it.
When writing a query statement today, You need to determine whether the end date is greater than the current date. Generally, you can use php to determine the date and then query it.
The following code is often used in php to obtain the SQL query statement for determining the date.
The Code is as follows:
$ Now = time (); // get the current date
$ SQL = "select * from 'team' where end_time> $ now ORDER BY sort_order limit 0, 4 ";
Obtain the MySql time function of the current time
There are many functions for processing MySql time and date. The following describes the MySql time functions used to obtain the current time. If you are interested in this, take a look.
The MySql time functions described below are used to obtain the current time. These MySql time functions are of great practical value and hope to help you learn MySql time functions.
The Code is as follows:
Mysql> select current_timestamp ();
+ --------------------- +
| Current_timestamp () |
+ --------------------- +
| 21:24:37 |
+ --------------------- +
1 row in set (0.00 sec)
Mysql> select current_date ();
+ ---------------- +
| Current_date () |
+ ---------------- +
| 2010-01-18 |
+ ---------------- +
1 row in set (0.00 sec)
Mysql> select current_time ();
+ ---------------- +
| Current_time () |
+ ---------------- +
| 21:24:46 |
+ ---------------- +
1 row in set (0.00 sec)