javascript - PHP calendar periods (weekly) -


i doing calendar , i'm stacked on week period of event. can't that, works, next month , others months not.

$i = 1;               $den = $post->day;             $mesic = $array['month'];             $rok = $array['year'];             $minusdays = $this->numdays(date('l', $den.".".$mesi.".".$rok));             $startedweek = date('w', strtotime($den.".".$post->month.".".$post->year));             $actualweek  = date('w', time());              $startedweek = $actualweek - $startedweek;               for($i; $i<6; $i++){                 if($i==1){                 $startedweek = $startedweek;             }else{                 $startedweek = $startedweek+1;             }                 $plusday = date('j', strtotime($den.".".$mesic.".".$rok." + ".$startedweek." weeks - ".$minusdays." days"));                 $plusweek = date('n',strtotime($den.".".$mesic.".".$rok." + ".$startedweek." weeks - ".$minusdays." days"));                 $plusyear = date('y',strtotime($den.".".$mesic.".".$rok." + ".$startedweek." weeks - ".$minusdays." days"));                         echo "<input type='hidden' class='interval' data-id='".$post->id."' data-name='".$post->name."' data-d='".$plusday."' data-day='".$plusday."'                         data-before='".$post->remindbefore."' data-unit='".$post->remindbeforeunit."' data-remindby='".$post->remindby."' data-remindinterval='".$post->remindinterval."'                         data-eventtimeh='".$post->remindh."' data-eventtimem='".$post->remindm."'>";                                              } 

$post->day day of period, $array['month'] listed month, $array['year'] listed year. function numdays returning 0-6 deppends on day it. thank you. must in hidden becouse html 5 calendar.

there ok, in column st, next month same, 2 months next in column Čt.

enter image description here

enter image description here

ok did solution, first startdate of period

$dayofweek = date('w', strtotime($post->day.".".$post->month.".".$post->year)); // day of week start period  

after set variable of first day, 1. go cyclus 0. after added variable loop in cycle every day , check if actual day wednesday or tuesday etc....

$dd=0;                          for($i=1; $i<7; $i++){                              for($c=0; $c<7; $c++){                                 $dd++;                                 $actualdayofweek = date('w', strtotime($dd.".".$array['month'].".".$array['year']));                                 $plusday = date('j', strtotime($dd.".".$array['month'].".".$array['year']));                                 if($dayofweek != $actualdayofweek){                                 }else{                                      $actualdayofweek = date('w', strtotime($dd.".".$array['month'].".".$array['year']));                                     $plusday = date('j', strtotime($dd.".".$array['month'].".".$array['year']));                                     echo "<input type='hidden' class='interval' data-id='".$post->id."' data-name='".$post->name."' data-d='".$dd."' data-day='".$plusday."'                                    data-before='".$post->remindbefore."' data-unit='".$post->remindbeforeunit."' data-remindby='".$post->remindby."' data-remindinterval='".$post->remindinterval."'                                    data-eventtimeh='".$post->remindh."' data-eventtimem='".$post->remindm."'>";                                       break;                                 }                             }                           } 

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -