在mySql数据库表中更改日期格式 [英] Change date format in mySql database table

查看:131
本文介绍了在mySql数据库表中更改日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家早上只是一个快速的问题。在我现有的MySql数据库中,我有几个列,其中包含日期。目前,这些是 yyyy-mm-dd 格式,但现在我需要将其全部更改为 dd-mm-yyyy 格式。我试过 select date_format(curdate(),'%​​d /%m /%Y'); ,但它不会更新我的表中的现有数据。有任何容易这样做吗或者即使它不容易,可以给我一些建议如何做,请谢谢。

解决方案

尝试使用

  SELECT DATE_FORMAT(dateColumn,'%d /%m /%Y' )AS dateColumn FROM table 


Morning everyone. Just a quick question. In my existing MySql database I've few columns with dates in it. Currently these are yyyy-mm-dd format but now I need to change it all to dd-mm-yyyy format. I've tried select date_format(curdate(), '%d/%m/%Y'); but it doesnt update existing data in my table.Is there any easy way of doing it? Or even if its not easy could you give me some suggestion how to do it please and thank you.

解决方案

Try using

SELECT DATE_FORMAT(dateColumn,'%d/%m/%Y') AS dateColumn FROM table

这篇关于在mySql数据库表中更改日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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