开发者

converting date format

How to conv开发者_运维问答ert date in a format 2011-08-17 to Wed, 17 Aug 2011 we are using the following format

<input type="text" name="date1" id="date1" class="calendarSelector" 
    value="<?php print date("D, d M Y"); ?>" />
$day1 = $this->input->post('date1');

But value got is 2011-08-17 How to convert it using php?


Try this:

date("D, j M Y", strtotime(date1));


This can be done by converting the value mentioned to a Unix timestamp and then formatting it using the standard date command.

<?php
echo date("D, j M Y", strtotime($day1));
?>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜