PHP日期格式从变量更改 [英] Php date format change from variable
本文介绍了PHP日期格式从变量更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从另一个函数获得php输出函数,并且它总是以这种格式返回日期:
I get php output function from another function and it always returns date in this-like format:
2012-05-24 09:05:20
所以我的问题是如何从变量$ p_re [ last_login ]我需要格式吗?我需要像
So my question is how can i get from variable $p_re["last_login"] format I need? I need to have it like
24.5.2012 09:05:20
谢谢大家,我在任何部分都没有找到它-从数据库更改权限,但是我需要从已经输出的变量中重写格式。谢谢。
Thank you all I did not find it in any section there are some - changing right from database but i need to "rewrite" format from already output variable. Thank you.
推荐答案
尝试一下此代码,即将在页面上显示日期之前
Try This code just before displaying date on page
$p_re["last_login"] = date('d.m.Y H:i:s', strtotime($p_re["last_login"]));
更多信息
'dmY'将返回24.05.2012
'd.m.Y' will return 24.05.2012
'dnY'将返回24.5.2012
'd.n.Y' will return 24.5.2012
这篇关于PHP日期格式从变量更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文