I feel a little silly for this, but is there a more elegant way to format the day suffix (st, th), other than calling date () 3 times?
What am I trying to output in html:
<p>January, 1<sup>st</sup>, 2011</p>
What am I doing now (very hard) in php:
//I am omitting the <p> tags: echo date('M j',$timestamp) . '<sup>' . date('S', $timestamp) . '</sup>' . date(' Y', $timestamp);
Does anyone know a better way?
date php formatting
Regis zaleman
source share