In mysql take the current time of the system and the current date to facilitate the query and determination of the code

  • 2020-05-12 06:22:49
  • OfStack

In php, the following code is often used to get the sql query that determines the date
 
$now = time(); // Gets the date of the current period  
$sql="select * from `team` where end_time>$now ORDER BY sort_order limit 0,4"; 



Gets the MySql time function for the current time

There are many functions that deal with MySql time and date, but if you're interested, here's the MySql time function for getting the current time

The MySql time function introduced below is used to get the current time. The MySql time function is of great practical value and I hope it can help you learn the MySql time function.
 
mysql> select current_timestamp(); 
+---------------------+ 
| current_timestamp() | 
+---------------------+ 
| 2010-01-18 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) 

Related articles: