如何将自定义日期格式从mysql值显示到php [英] how to display custom date format from mysql value to php
本文介绍了如何将自定义日期格式从mysql值显示到php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Mysql表中有一个列日期。
日期显示如2014-01-09
现在我需要将此格式转换为09-01-2014并在我的php文件中显示
i在查询中使用了一个函数,例如
选择str_to_date('date','%d-%m-%Y')来自` table_name`;
但我不能正确
上述查询功能格式是否有任何错误?
谢谢
解决方案
约会时间格式 [ ^ ]
约会时间犯人 [ ^ ]
< pre lang =php>
date = new DateTime(' 2014年1月9' 日跨度>);
echo
date-> format(' dm-Y');
I am having a column date in Mysql table.
date displays like 2014-01-09
Now i need to convert this format to 09-01-2014 and to display in my php file
i used a function in a query like
select str_to_date('date','%d-%m-%Y') from `table_name`;
but i cant get correct
is there any mistake in the above query function format?
Thanks
解决方案
Date time formate[^]
Date Time Formate[^]
date = new DateTime('2014-01-09'); echo
date->format('d-m-Y');
这篇关于如何将自定义日期格式从mysql值显示到php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文