使用php将mysql日期(datetime)转换为更好的日期格式 [英] Convert a mysql date (datetime) into a better date format using php
本文介绍了使用php将mysql日期(datetime)转换为更好的日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
2010-02-03 22:21:26
有没有人知道一个简单的解决方案,使日期更加用户友好的格式。例如
2010年3月2日22:21。
解决方案
请参阅 strtotime()和 date()
例如, 2010-02-03 22:21:26
to 2010年2月3日22:21
:
$ DateTimeStr ='2010-02-03 22:21:26';
echo date('jS F Y \a\t G:i',strtotime($ DateTimeStr));
I some php code which gets info from a mysql database. The problem is that the date is coming out in the format : "2010-02-03 22:21:26"
Does anyone know a simple solution to make the date more user friendly format. e.g
2nd march 2010 at 22:21.
解决方案
See strtotime() and date()
e.g., 2010-02-03 22:21:26
to 3rd February 2010 at 22:21
:
$DateTimeStr = '2010-02-03 22:21:26';
echo date('jS F Y \a\t G:i', strtotime($DateTimeStr));
这篇关于使用php将mysql日期(datetime)转换为更好的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文