Hi,
i want to check if today is the last day of the month, but i don't really know how. i want to write it in php.
can you help?
thanks, Sebastian
Hi,
i want to check if today is the last day of the month, but i don't really know how. i want to write it in php.
can you help?
thanks, Sebastian
There is probably a more elegant solution than this but you can just use php's date function:
$maxDays=date('t');
$currentDayOfMonth=date('j');
if($maxDays == $currentDayOfMonth){
//Last day of month
}else{
//Not last day of the month
}
And here it is, wrapped up as a function:
function is_last_day_of_month($timestamp = NULL) {
if(is_null($timestamp))
$timestamp = time();
return date('t', $timestamp) == date('j', $timestamp);
}