Get all days and date for a given month

后端 未结 9 1515
天涯浪人
天涯浪人 2021-02-10 08:17

Would like to retrieve all days and date for a given month. Have this currently which shows all the days for the current month, but how do I parse in a specified month instead?<

9条回答
  •  梦谈多话
    2021-02-10 08:41

    $list=array();
    $d = 13;
    $year = 2019;
    
    for($m=1; $m<=12; $m++)
    {
        $time=mktime(12, 0, 0, $m, $d, $year);          
        if (date('m', $time)==$m)       
            $list[]=date('D-d-m-Y', $time);
        }
    

    In this one you can put a spesific number and outpout all the days in the year that have the same number. example i wanted to outpout all the 13th days of the month. (if you want to find every Friday 13th that what you have to use)

提交回复
热议问题