IT & Programming

Get long date with php

This function accepts date as parameter and returns long formatted date.

Function

function getLongDate($date) {

    $date = date('dS F Y', strtotime($date));

	if (substr($date, 0, 1) == 0){
	
		$date = substr($date, 1);
	}

    return $date;
}

Calling The Function

echo getLongDate('2006-11-21');

Output

21st November 2006

Leave A comment

Email address is optional and will not be published. Only add email address if you want a reply from blog author.
Please fill required fields marked with *