mysql unix时间戳存储与FROM_UNIXTIME()格式化时间戳函数
定义: 存储时间比如 user 表 login_time 字段
用unix时间戳的方式存储
`login_time` int(11) NOT NULL DEFAULT 0 COMMENT '登录时间',
from_unixtime 语法
FROM_UNIXTIME(unixtime,format)unixtime unix时间戳
format 时间格式%Y 年 如2020
%m 月份 01->12
%d 日期 01->31
查找 今天 2020-03-16 登录过的用户 sql
SELECT * FROM user where from_unixtime(login_time,'%Y-%m-%d') = '2020-03-16';
+-----+----------------------------+
| id | login_time |
+-----+----------------------------+
| 138 | 1581796000 |
+-----+----------------------------+
1 row in set (0.00 sec)
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。