How to get last day of current month from date in Codeigniter ?
Jan 08, 2021
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 4 jQuery Client Side Form Validation Tutorial Example
- Codeigniter - Load more data on page scroll using jQuery and Ajax
- Codeigniter Image Crop With JQuery Croppie Example Tutorial
- CodeIgniter 4 jQuery Form Validation Example
- Codeigniter 4 Ajax Load More Data On Page Scroll With JQuery Tutorial
- CodeIgniter 4 - React JS CRUD with MySQL Example
- Codeigniter Create Bar Chart In PHP With Chart Js
- PHP Codeigniter 4 Google Bar & Line Charts Tutorial