Answers for "get all mondays in a month php"

PHP
1

php get all saturdays in a month

function getSundays($y, $m) {
    return new DatePeriod(
        new DateTime("first sunday of $y-$m"),
        DateInterval::createFromDateString('next sunday'),
        new DateTime("last day of $y-$m")
    );
}

// Usage:
foreach (getSundays(2021, 03) as $sundays) {
    echo $sundays->format("l, Y-m-d\n");
}
Posted by: Guest on March-19-2021
0

php get all the mondays of the year

$endDate = strtotime($endDate);
for($i = strtotime('Monday', strtotime($startDate)); $i <= $endDate; $i = strtotime('+1 week', $i))
    echo date('l Y-m-d', $i);
Posted by: Guest on August-05-2021

Code answers related to "get all mondays in a month php"

Browse Popular Code Answers by Language