开发者

WordPress how to split month and day date into two pieces

Ho开发者_如何学JAVAw can I split the "month" and "day" date into two seperate pieces so I can place them under each other like this:

WordPress how to split month and day date into two pieces


To obtain the current day you can:

echo date('d');

and for current month:

echo date('m');

in a short textual representation of a month, three letters:

echo date('M');

But if you have the date already in a string variable you can for day:

echo date('d',strtotime('11/26/2011'));

and for month:

echo date('M',strtotime('11/26/2011'));

For complete references of the functions:

  • date()
  • strtotime()


<p class="month"><?php echo get_the_date('M'); ?></p>
<p class="day"><?php echo get_the_date('d'); ?></p>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜