phpMyAdmin MySQL时间戳显示尾随零 [英] phpMyAdmin MySQL TimeStamp Shows Trailing Zeroes

查看:96
本文介绍了phpMyAdmin MySQL时间戳显示尾随零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道为什么在phpMyAdmin/MySQL中显示时间戳的原因已从:

Does anyone know why in phpMyAdmin/MySQL displaying Time Stamps changed from:

2012-10-20 08:43:28 

2012-10-20 08:43:28.000000 

,带尾随零.这似乎始于phpMyAdmin版本4的发布.希望时间戳显示为:

with trailing zeroes. This seems to have started with the release of phpMyAdmin Version 4. Would like the Time Stamp to show as:

2012-10-20 08:43:28

该字段的属性为名称:日期",类型":时间戳",默认值:"Current_Timestamp".

The attributes of the field are Name: date, Type: timestamp, Default: Current_Timestamp.

推荐答案

phpMyAdmin从

phpMyAdmin began displaying the fractional part of timestamps as of 4.1.0. If you'd like to display your timestamps without the fractional part, you can adapt this query:

SELECT DATE_FORMAT(`date`, '%Y-%m-%d %H:%i:%s') FROM your_table;

结果如下:

MariaDB [my_database]> SELECT DATE_FORMAT(`date`, '%Y-%m-%d %H:%i:%s') `date` 
    FROM your_table LIMIT 1;
+---------------------+
| date                |
+---------------------+
| 2014-01-22 17:54:11 |
+---------------------+
1 row in set (0.00 sec)

MariaDB [my_database]>

这篇关于phpMyAdmin MySQL时间戳显示尾随零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆