06-Jan-2021
.
Admin
Hi Guys,
In this example,I will learn you how to convert number to month name in codeigniter.you can easy nad simply convert number to month name in codeigniter.
The DateTime::createFromFormat() function is an inbuilt function in codeigniter which is used to parses a time string according to a specified format. This function accepts three parameters and returns new DateTime in success or false on failure.
Example:
public function index()
{
$monthNum = 5;
$dateObj = DateTime::createFromFormat('!m', $monthNum);
$monthName = $dateObj->format('F');
echo $monthName;
}
Output:
May
It will help you...
#Codeigniter