// Returns the timestamp for the last day of a given month for a given year.
// Expects: Month starting from 1 index and 4 digit year
// Returns: Timestamp for last day of given month/year
// Remember to set default timezone (Here we are using west coast US)
date_default_timezone_set('US/Pacific');
function lastDayOfMonth($month, $year) {
return mktime(23, 59, 59, $month + 1, 0, $year);
}
Posted: March 18, 2023
Return to the snippets listing