Saturday, January 8, 2011

get last day of the current month in PHP

Get Last Day Of The Current Month


To get the last day of the month so got this piece of code.
try the following code all are different format....

date('Y-m-d', strtotime('-1 second', strtotime(date('m') . '/01/' . date('Y') . '00:00:00')))

date(“Y-m-d”,mktime(0,  0,  0, (date(‘m’) + 1), 0, date(‘Y’)))

strtotime(‘+1 month -1 second ‘ . date(‘Y’) . ’-’ . date(‘m’) . ’-01′ );

date(“Y-m-t”); //t = number of days in the month

date(“Y-m-d’,mktime(0, 0, 0,  2, 32, 2008));

date(‘t’,strtotime(“last month”));

date(‘D Y-m-t’, strtotime(“last month”))

No comments: