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:
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>
精彩评论