PHP strtotime 问题与分钟 [英] PHP strtotime problems with minutes
本文介绍了PHP strtotime 问题与分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这行正常吗:
echo date("Y-m-d h:m:s a", strtotime('2012-03-18 12:55:00'))
给我 2012-03-18 12:03:00 pm
gives me 2012-03-18 12:03:00 pm
无论我输入多少分钟,我总是得到 03 分钟......很奇怪.
Whatever the minutes I enter, I always get 03 minutes... weird.
推荐答案
你的日期字符串格式应该是:
Your date string format should be :
Y-m-d h:i:s a
PHP 的文档有关于格式化本地时间/日期的说明 -
PHP's documentation has this to say about formatting a local time/date -
i
- 带前导零的分钟m
- 月份的数字表示,带前导零
i
- Minutes with leading zerosm
- Numeric representation of a month, with leading zeros
您所看到的 03
实际上是月份 - 三月 :)
What you were seeing as 03
was actually the month - March :)
这篇关于PHP strtotime 问题与分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文