How to get last day of current month from date in Codeigniter ?

09-Jan-2021

.

Admin

Hi Guys,

In this example,I will learn you how to get last day of current month from date in codeigniter.you can easy and simply get last day of current month from date in codeigniter.

Within $format, we will pass “Y-m-t” and within $timestamp the date taken above. In terms of date “Y” gives a full numeric representation of a year in 4 digits, “m” provides numeric representation of a month and “t” gives the number of days in the given month.

Example:


public function index()

{

$date = date('Y-m-t');

echo $date;

}

Output:

2021-01-31

It will help you...

#Codeigniter