mysql时间戳函数

1.from_unxitime

https://blog.csdn.net/fdipzone/article/details/51018930

格式化linux时间戳,一般使用字段类型int(11)时间戳来保存时间,这样方便查询时提高效率。

mysql提供了一个时间戳格式化函数from_unixtime来转换格式。

from_unixtime(unix_timestamp, format)  //format默认是%Y-%m-%d %H:%i:%s格式

 

例子: 

mysql> select from_unixtime(1459338786);
+---------------------------+
| from_unixtime(1459338786) |
+---------------------------+
| 2016-03-30 19:53:06       |
+---------------------------+

 

posted @   lypbendlf  阅读(397)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
历史上的今天:
2018-08-19 PAT 1042 Shuffling Machine[难]
2018-08-19 PAT 1066 Root of AVL Tree[AVL树][难]
2018-08-19 PAT 1064 Complete Binary Search Tree[二叉树][难]
点击右上角即可分享
微信分享提示