Return to Snippet

Revision: 27114
at May 23, 2010 09:26 by cigraphics


Initial Code
function fday($time) {
	$day = date('d', $time);
	if ( substr($day, -1) == 1 ):
		$end = 'st';
	elseif ( substr($day, -1) == 2 ):
		$end = 'nd';
	elseif ( substr($day, -1) == 3 ):
		$end = 'rd';
	else:
		$end = 'th';
	endif;
	
	return date('F, d', $time).$end.date(' Y', $time);;
}

Usage:
$time = time();
echo fday($time);

Initial URL

                                

Initial Description

                                

Initial Title
Add st, nd, rd, th to days :D

Initial Tags
date

Initial Language
PHP