[英]How to change Date format of column without convert into string in Mysql Database
I have column of CREATEDATE
its format is like '2014-03-25 19:00:00'
in mysql database. 我有
CREATEDATE
列,其格式类似于mysql数据库中的'2014-03-25 19:00:00'
。 I need to create another column with format '2014-03-25'
without any conversion into a String or any other type. 我需要创建另一列格式为
'2014-03-25'
列,而无需将其转换为字符串或任何其他类型。 The Column should be 'DATE'
type only. 列只能是
'DATE'
类型。
Try this 尝试这个
ALTER TABLE tbl_name ADD `date` DATE NOT NULL DEFAULT
update tbl_name set date=CREATEDATE
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.