定义表结构时,时间我选择的是 timestamp,插入数据都没有问题.
但是 select 出来的数据为什么就是 datetime 格式的,是不是和 mysql 版本有关?
我想要获取数字字符串格式的,难道还要使用 mysql 的函数?
求解答
但是 select 出来的数据为什么就是 datetime 格式的,是不是和 mysql 版本有关?
我想要获取数字字符串格式的,难道还要使用 mysql 的函数?
求解答
1
815979670 Sep 28, 2018 via Android 时间戳格式就存 int 类型 MySQL 的时间类型都会自动转为时间格式,
|
2
newtype0092 Sep 28, 2018
默认 timestamp 就显示成系统设置的时间格式,需要时间戳用 unix_timestamp(time) 转一下。
|
3
newtype0092 Sep 28, 2018 一般都是存成 int,需要时间字符串的话用
date_format(, '%Y-%m-%d %H:%i:%s') |
4
newtype0092 Sep 28, 2018
@newtype0092
手滑。。。 用 from_unixtime(int_timestamp) 转成默认日期格式 或者 date_format(from_unixtime(int_timestamp), '%Y-%m-%d %H:%i:%s') 自定义格式 |
5
ksaa0096329 OP @newtype0092 了解了
|