ITPub博客

首页 > IT职业 > IT职场 > mysql中取系统当前时间,当前日期方便查询判定的代码

mysql中取系统当前时间,当前日期方便查询判定的代码

IT职场 作者:liuxuhui 时间:2021-09-09 09:37:19 0 删除 编辑

           php中常通过下面的代码,得到判定日期的sql查询语句
复制代码 代码如下:
$now = time(); //获取当期的日期
$sql="select * from `team` where end_time>$now ORDER BY sort_order limit 0,4";



获取当前时间的MySql时间函数

处理MySql时间日期的函数有很多,下面为您介绍的就是用于获取当前时间的MySql时间函数,如果您对此感兴趣的话,不妨一看

下面为您介绍的MySql时间函数用于获取当前时间,该MySql时间函数极具实用价值,希望能对您学习MySql时间函数方面有所帮助。
复制代码 代码如下:
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)
                       

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/756/viewspace-2811009/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2020-06-19

  • 博文量
    583
  • 访问量
    11537