Mysql:创建表时将DATETIME的格式设置为“DD-MM-YYYY HH:MM:SS” [英] Mysql: Setup the format of DATETIME to 'DD-MM-YYYY HH:MM:SS' when creating a table

查看:2510
本文介绍了Mysql:创建表时将DATETIME的格式设置为“DD-MM-YYYY HH:MM:SS”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在googling之后,我找不到一种方法来创建一个带有 DATETIME 列的新表,默认格式设置为' DD-MM -YYYY HH:MM:SS '



我看到一个教程,在 phpmyadmin 所以我怀疑我可以使用mysql通过命令行和实现相同的事情,当创建我的新表与

 提前感谢您

h2_lin>解决方案

MySQL以YYYY-MM-DD HH:MM:SS格式检索并显示DATETIME值。
这是从mysql网站。您只能存储此类型,但您可以使用许多时间格式函数中的一个来更改它。



Mysql时间和日期函数


After googling around, I cannot find a way to create a new table with a DATETIME column with the default format set to 'DD-MM-YYYY HH:MM:SS'

I saw a tutorial in which it was done in phpmyadmin so I suspect that I could use mysql via command line and achieve the same thing when creating my new table with

CREATE TABLE ()

Thank you in advance

解决方案

"MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format." This is from mysql site. You can store only this type, but you can use one of the many time format functions to change it, when you need to display it.

Mysql Time and Date functions

这篇关于Mysql:创建表时将DATETIME的格式设置为“DD-MM-YYYY HH:MM:SS”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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