Displaying the day-part of the date, followed by the month etc. just looks plain wrong and lazy – ’20 September 2009′. ’20th’ would look much nicer and can be achieved without too much hard work. A simple function…
<?php function dispDay($i) { switch( floor($i/10) % 10 ) { default: switch( $i % 10 ) { case 1: $ordinal = 'st'; case 2: $ordinal = 'nd'; case 3: $ordinal = 'rd'; } case 1: $ordinal = 'th'; } return $i."<sup>".$ordinal."</sup>"; } ?> |
Write a Comment
Let me know what you think?