2017-08-17 10 views
1

を控え7日に、現在の日付からのデータのを聞いて、過去7日間。どのように私はこれを達成することができます。 現在の+7日と-7日の前回のゲームと新しいゲームのデータを表示すると仮定します。私は週にゲームマッチの束を選択しようとしている

は現在、私はこの問題は解決されているこの

function testFR(){ 
    $DateFrom = new DateTime(); 
    $DateTo = new DateTime(); 
    $DateTo->add(new DateInterval("P7D")); 
    $laMatches = (array)WaterpoloAPICached::call("Matches", "getMatches", Array(
     isset($_GET["SeasonId"]) ? $_GET["SeasonId"] : "", 
     isset($_GET["DepartmentId"]) ? $_GET["DepartmentId"] : "", 
     isset($_GET["ClubId"]) ? $_GET["ClubId"] : "", 
     isset($_GET["TeamId"]) ? $_GET["TeamId"] : "", 
     isset($_GET["PoolId"]) ? $_GET["PoolId"] : "", 
     date_format($DateFrom, 'd-m-Y'), 
     date_format($DateTo, 'd-m-Y'), 
     isset($_GET["RefereeId"]) ? $_GET["RefereeId"] : "",  
    )); 
    // Sort Matches ascending 
     usort($laMatches, function($a, $b) { 
         return stringToUnix($a->Date) - stringToUnix($b->Date); 
     }); 
/* echo "<h6 id='rcorners' style='background-color:#3db7e4; padding: 1rem; color:white;'><strong>Wedstrijden</strong></h6>"; */ 
    echo "<table class='hover'>"; 
    echo "<tbody >";   
    $lnToday = date("d-m-Y", strtotime("+7 days"));      
          $lcCurrent = "";       
     foreach($laMatches as $loMatch) { 
      if(stringToUnix($loMatch->Date) >= $lnToday) { 
       if($lcCurrent != $loMatch->Date) {  
      echo "<thead>"; 
      echo "<tr >"; 
      echo "<th class='text-center'>"; 
      echo "$loMatch->Date</th>"; 
      echo "<th class='text-center'></th>";  
      echo "<th class='text-center'></th>"; 
      echo "<th class='text-center'></th>"; 
      echo "<th class='text-center'>Division</th>"; 
      echo "</tr>";     
      echo "</tr> 
       </thead>";   
        }    
        $lcCurrent = $loMatch->Date;      
      echo "<tr class='text-center'>"; 
       echo "<td >$loMatch->Time</td>"; 
       echo "<td>$loMatch->HomeTeam </td>"; 
       echo "<td><strong><a href='..\match?MatchId=".$loMatch->Id."&Report=".$loMatch->MatchReport."'>$loMatch->ResultHome - $loMatch->ResultGuest </a></strong></td>"; 
       echo "<td> $loMatch->AwayTeam</td>"; 
       echo "<td> $loMatch->DepartmentName</td>"; 
      echo "</tr>"; 
      } 
     }  
     echo "</tbody>"; 
     echo "</table>";   
} 

を持っています!同じような問題を抱えている人のために...この助けを願って!

+0

ご覧のとおり、タグが編集されています。ロジックをクライアントに移動しない限り、jQueryはありません – mplungjan

+0

thx Rory!編集のために –

答えて

0

あなたはほとんどそれを得ました。手続き的な方法で日付から時間を加算/減算することができます:

$lnToday = date("d-m-Y", strtotime("+7 days")); 
+0

thxミラノ私はそれを試みます! –

+0

まだすべてのゲームのリストを取得しています。私は何を間違えているのですか?私はこれまでのことを編集しました。 ..私はまだちょっとスタート時間の終了時間が必要ですか? –

+0

申し訳ありません。 '$ loMatch-> Date'は何を返しますか? – ishegg

関連する問題

 関連する問題