Echo all months with days calendar

后端 未结 5 1760
星月不相逢
星月不相逢 2021-02-06 20:12

I am using the code below to echo the current month. How can i enhance it so that is shows all the months with the names and days and dates..

Code:

 &         


        
5条回答
  •  借酒劲吻你
    2021-02-06 20:38

    $daysArr = array('Mon','Tue','Wed','Thu','Fri','Sat','Sun');
    $monthtotdays= cal_days_in_month(CAL_GREGORIAN,date('m'),date("Y"));
    $currdays=jddayofweek (cal_to_jd(CAL_GREGORIAN, date('m'),1, date("Y")) , 2 );
    $currdaysval = 0;
    echo "";
    echo "";
    for($d=0;$d<=6;$d++){
    echo "";
    if($daysArr[$d]==$currdays)  $currdaysval = $d;
    }
    
    echo "";
    echo "";
    if($currdaysval > 0 ){
    echo '';
    }
    for($i=1;$i<=$monthtotdays;$i++){
    echo "";
    if(($i+$currdaysval )%7 <= 0 ){
    echo "";
    }
    }
    echo "
    ". $daysArr[$d]."
     ".$i."
    "

提交回复
热议问题