网站首页 > 博客文章 正文
MySQL时间、字符串、戳的转换
select date_format(now(), ‘%Y-%m-%d %H:%i:%s’);
结果:2018-05-02 20:24:10
时间转时间戳
select unix_timestamp(now());
结果:1525263383
字符串转时间
select str_to_date(‘2018-05-02’, ‘%Y-%m-%d %H’);
结果:2018-05-02 00:00:00
字符串转时间戳
select unix_timestamp(‘2018-05-02’);
结果:1525263383
时间戳转时间
select from_unixtime(1525263383);
结果:2018-05-02 20:16:23
时间戳转字符串
select from_unixtime(1525263383, ‘%Y-%m’);
结果:2018-05
记得双击关注 么么哒!
- 上一篇: MySQL系列-第2篇:MySQL中数据类型介绍
- 下一篇: Mysql日期函数、时间函数的实际应用
猜你喜欢
- 2024-12-06 超详细canal入门,看这篇就够了
- 2024-12-06 MySQL专题1: 字段和索引
- 2024-12-06 这些MySQL面试题集锦,据说知名互联网公司都用
- 2024-12-06 mysql数据库一天五万条以上的增量,预计运维三年,怎么优化
- 2024-12-06 Mysql时间格式转化——DATE_FORMAT()
- 2024-12-06 RPA数据库功能应用及时间戳获取
- 2024-12-06 Mysql日期函数、时间函数的实际应用
- 2024-12-06 MySQL系列-第2篇:MySQL中数据类型介绍
- 2024-12-06 Mysql:TIMESTAMP、DATETIME、BIGINT。该如何选择?
- 2024-12-06 经典面试题-在 MySQL 中,datetime 和 timestamp有什么区别?
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- powershellfor (55)
- messagesource (56)
- aspose.pdf破解版 (56)
- promise.race (63)
- 2019cad序列号和密钥激活码 (62)
- window.performance (66)
- qt删除文件夹 (72)
- mysqlcaching_sha2_password (64)
- ubuntu升级gcc (58)
- nacos启动失败 (64)
- ssh-add (70)
- jwt漏洞 (58)
- macos14下载 (58)
- yarnnode (62)
- abstractqueuedsynchronizer (64)
- source~/.bashrc没有那个文件或目录 (65)
- springboot整合activiti工作流 (70)
- jmeter插件下载 (61)
- 抓包分析 (60)
- idea创建mavenweb项目 (65)
- vue回到顶部 (57)
- qcombobox样式表 (68)
- vue数组concat (56)
- tomcatundertow (58)
- pastemac (61)
本文暂时没有评论,来添加一个吧(●'◡'●)