开发者

getting month from given date php

开发者 https://www.devze.com 2023-04-02 19:30 出处:网络
given this code to retrieve the date from and date to: <dl> <dt><label for=\"calendar\">Date From:</label></dt>

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 i开发者_Python百科n timestamp: 13/09/2011 10:05... thanks...


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)


 $date_from = $_POST['timestamp'];
 $month_from = substr($date_from,strpos($date_from,'/'),2);
 $date_to = $_POST['timestamp1'];
 $month_to = substr($date_to,strpos($date_to,'/'),2);
0

精彩评论

暂无评论...
验证码 换一张
取 消