Mysql: Setup the format of DATETIME to 'DD-MM-

2019-01-04 12:23发布

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

9条回答
Deceive 欺骗
2楼-- · 2019-01-04 13:02

No you can't; datetime will be stored in default format only while creating table and then you can change the display format in you select query the way you want using the Mysql Date Time Functions

查看更多
唯我独甜
3楼-- · 2019-01-04 13:05
Dim x as date 

x = dr("appdate")
appdate = x.tostring("dd/MM/yyyy")

dr is the variable of datareader

查看更多
劫难
4楼-- · 2019-01-04 13:07

try this:

DATE NOT NULL FORMAT 'YYYY-MM-DD'
查看更多
登录 后发表回答