从给定日期获取月份 php
给定此代码来检索日期自和日期至:
<dl>
<dt><label for="calendar">Date From:</label></dt>
<dd><input type="text" name="timestamp" id="calendar1" class="calendarFocus" size="32" maxlength="128" /></dd>
</dl>
<dl>
<dt><label for="calendar">Date To:</label></dt>
<dd><input type="text" name="timestamp1" id="calendar1" class="calendarFocus" size="32" maxlength="128" /></dd>
</dl>
我怎样才能只获取月份?
**这是上面时间戳中日期的输出格式:13/09/2011 10:05...谢谢...
given this code to retrieve the date from and date to:
<dl>
<dt><label for="calendar">Date From:</label></dt>
<dd><input type="text" name="timestamp" id="calendar1" class="calendarFocus" size="32" maxlength="128" /></dd>
</dl>
<dl>
<dt><label for="calendar">Date To:</label></dt>
<dd><input type="text" name="timestamp1" id="calendar1" class="calendarFocus" size="32" maxlength="128" /></dd>
</dl>
how can I get only the month?
**this is the Output format of the date above in timestamp: 13/09/2011 10:05... thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
date('M', strtotime( $timestamp ));
将
M
替换为以下任意项:F
-- 的完整文本表示一个月,例如一月或三月。 (一月到十二月)m
-- 月份的数字表示形式,带前导零 (< strong>01 到 12)M
-- 月份的简短文本表示,三个字母(Jan< /strong> 至12 月)n
-- 月份的数字表示形式,不带前导零(1 到 12)t< /code> -- 给定月份的天数(28 到 31)
date('M', strtotime( $timestamp ));
Swap
M
with any of the following:F
-- A full textual representation of a month, such as January or March. (January through December)m
-- Numeric representation of a month, with leading zeros (01 through 12)M
-- A short textual representation of a month, three letters (Jan through Dec)n
-- Numeric representation of a month, without leading zeros (1 through 12)t
-- Number of days in the given month (28 through 31)