如何在PHP中重新格式化日期? [英] How to reformat date in PHP?
本文介绍了如何在PHP中重新格式化日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
2009-08-12
数字年 - 数字月 - 数字日
如何将这些日期重新格式化为更友好的用户,如:
2009年8月12日
/ pre>
数字月数字日期,数字年
假设从mysql数据库获取的日期存储在一个变量中:
$ date = $ row ['date_selected'];
解决方案
date ,Y,strtotime($ input))
I am pulling the dates of various posts from a database. The dates are in the following format:
2009-08-12 Numeric Year - Numeric Month - Numeric Day
How can I reformat these dates to something more user friendly like:
August 12, 2009 Numeric Month Numeric Date, Numeric Year
Assuming that the date gotten from the mysql database is stored in a variable called:
$date = $row['date_selected'];
解决方案
date("F d, Y", strtotime($input))
这篇关于如何在PHP中重新格式化日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文