Wednesday, 5 October 2016

Get all days and date for a given month in php




HTML & PHP CODE

<!DOCTYPE html>
<html>
<body>

<?php
$list=array();
$month = 10;
$year = 2016;

for($d=1; $d<=31; $d++)
{
    $time=mktime(12, 0, 0, $month, $d, $year);          
    if (date('m', $time)==$month)       
        $list[]=date('Y-m-d-D', $time);
}
echo "<pre>";
print_r($list);
echo "</pre>";
?>

</body>
</html>

Get all days and date for a given month in php


No comments:

Post a Comment