Posted inMysql / Mysqli / php

get last date of month in php – 5 Ways to find the last day of the month from date

get last date of month in php : Php time timestamp Get the first day and last day of the current month, last month, next month, etc.

get last date of month in php

PHP DateTime to Get the Last Date of the Month – How to get last day of a month from date in PHP ? – for example ‘last day of’, Sets the day to the last day of the current month.

PHP: Get last day of month

This month.
The last day of this month:


From a given date.


Using the DateTime object.

format('Y-m-t');

php get start and end date of month and year


First day of the month.

echo date('Y-m-01', strtotime($user_first_dt));

Last day of the month.

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

Don't Miss : Current Month In Php

get last month php

get last month php

$currentMonth = date('M');// if number, then date('m');
//Last month
$lastMonth = Date("F", strtotime("first day of previous month");
var_dump($lastMonth);

$nextMonth = Date("F", strtotime("first day of next month");
var_dump($nextMonth);

get last month using php

$lastMonth = Date("F", strtotime("first day of previous month");
var_dump($lastMonth);

$nextMonth = Date("F", strtotime("first day of next month");
var_dump($nextMonth);

I hope you get an idea about get last date of month in php.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype