php的大哥大姐们,帮小弟我解决一个有关问题一下

WBOY
Release: 2016-06-13 13:41:58
Original
965 people have browsed it

php的大哥大姐们,帮我解决一个问题一下
我有一个变量:$strDate,这个变量值有可能是2012-01-09也有可能是2008-05-06...不 定是所有时间中的任何一天,
现在我想返回 这个变得值所在的月份

也就是说:返回指定日期的月份,

当$strDate=2012-08-06 是返回:8
当$strDate=2010-02-06 是返回:2
当$strDate=2006-08-06 是返回:8
当$strDate=2015-08-06 是返回:8

这个函数是什么 `>?

------解决方案--------------------
echo date('n', strtotime($strDate));

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!