How to Get the Last Day Of Specific Month In Codeigniter ?

Codeigniter

Nicesnippets

582

12-01-2021


Hi Guys,

In this example,I will learn you how to get the last day of specific month in Codeigniter.you can easy and simply get the last day of specific month in Codeigniter.

Sometimes we need How to get the last day of a month from a specific date in Codeigniter for various purposes. We can do it in many ways.

Example:


public function index()

{

$query_date = '2021-01-10';

// Last day of the month.

echo date('Y-m-t', strtotime($query_date));

}

Output:

2021-01-31

It will help you...