易商讯
当前位置: 首页 » 资讯 » 知识 » 正文

mysql(mysql workbench)

放大字体  缩小字体 发布日期:2023-11-15 18:59:51
导读

mysql中date函数是什么,怎么使用呢?不知道的小伙伴来看看小编今天的分享吧!1、date函数简介:MySQL数据库Date()日期函数,用于MySQL数据...

mysql, mysql中的date函数是什么,如何使用?不知道小伙伴们今天来看看边肖的分享吧!

1.日期功能介绍:

MySQL数据库Date () date函数,用于查询MySQL数据库中的当前日期和时间。

2.用法:

获取当前时间:

MySQLselectcurrent_timestamp();

+---------------------+

|current_timestamp()|

+---------------------+

|2010-01-1821:24:37|

+---------------------+

1rowinset(0.00sec)

MySQLselectcurrent_date();

+----------------+

|current_date()|

+----------------+

|2010-01-18|

+----------------+

1rowinset(0.00sec)

MySQLselectcurrent_time();

+----------------+

|current_time()|

+----------------+

|21:24:46|

+----------------+

1rowinset(0.00sec)

mysql workbench

Unix时间:

MySQLselectunix_timestamp();

+------------------+

|unix_timestamp()|

+------------------+

|1263821184|

+------------------+

1rowinset(0.00sec)

MySQLselectfrom_unixtime(1263821182);

+---------------------------+

|from_unixtime(1263821182)|

+---------------------------+

|2010-01-1821:26:22|

+---------------------------+

1rowinset(0.00sec)

大约时间:

MySQLselectdate_add(current_timestamp,interval1day);

+---------------------------------------------+

|date_add(current_timestamp,interval1day)|

+---------------------------------------------+

|2010-01-1921:27:53|

+---------------------------------------------+

1rowinset(0.00sec)

MySQLselectdate_add(current_time,interval1day);

+----------------------------------------+

|date_add(current_time,interval1day)|

+----------------------------------------+

|NULL|

+----------------------------------------+

1rowinset,1warning(0.00sec)

MySQLselectdate_add(current_date,interval1day);

+----------------------------------------+

|date_add(current_date,interval1day)|

+----------------------------------------+

|2010-01-19|

+----------------------------------------+

1rowinset(0.00sec)

MySQLselectdate_sub(current_timestamp,interval1day);

+---------------------------------------------+

|date_sub(current_timestamp,interval1day)|

+---------------------------------------------+

|2010-01-1721:28:41|

+---------------------------------------------+

1rowinset(0.00sec)

MySQLselectdate_sub(current_date,interval1day);

+----------------------------------------+

|date_sub(current_date,interval1day)|

+----------------------------------------+

|2010-01-17|

+----------------------------------------+

1rowinset(0.00sec)

MySQLselectdate_sub(current_time,interval1day);

+----------------------------------------+

|date_sub(current_time,interval1day)|

+----------------------------------------+

|NULL|

+----------------------------------------+

1rowinset,1warning(0.00sec)

mysql workbench

时间间隔:

MySQLselectdatediff(2010-01-18,2010-01-17);

+-------------------------------------+

|datediff(2010-01-18,2010-01-17)|

+-------------------------------------+

|1|

+-------------------------------------+

1rowinset(0.00sec)

MySQLselecttimediff(2010-01-1812:00,2010-01-1711:00);

+-------------------------------------------------+

|timediff(2010-01-1812:00,2010-01-1711:00)|

+-------------------------------------------------+

|25:00:00|

+-------------------------------------------------+

1rowinset(0.00sec)

时间转换:

MySQLselecttime_to_sec(25:00:00);

+-------------------------+

|time_to_sec(25:00:00)|

+-------------------------+

|90000|

+-------------------------+

1rowinset(0.00sec)

MySQLselectsec_to_time(90000);

+--------------------+

|sec_to_time(90000)|

+--------------------+

|25:00:00|

+--------------------+

1rowinset(0.00sec)

mysql,以上就是本文为您收集整理的mysql最新内容,希望能帮到您!更多相关内容欢迎关注。


声明:易商讯尊重创作版权。本文信息搜集、整理自互联网,若有来源标记错误或侵犯您的合法权益,请联系我们。我们将及时纠正并删除相关讯息,非常感谢!

关键词: mysql
 
(文/小编)
免责声明
• 
本文mysql(mysql workbench)链接:http://www.esxun.cn/news/384533.html 。本文仅代表作者个人观点,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们,我们将在24小时内处理完毕。如涉及作品内容、版权等问题,请在作品发表之日起一周内与本网联系,否则视为放弃相关权利。
 

Copyright © www.esxun.cn 易商讯ALL Right Reserved


冀ICP备2023038169号-3