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.

Leave a Comment