データベースの日付のフォーマットをdatetimeに変えます。
create table weather.marunouchis(
id int unsigned auto_increment primary key,
forecast datetime,
main varchar(255),
description varchar(255),
temp float,
humidity int,
cloud int,
speed float,
created datetime default null
);
Controllerで条件を追記します。
class MarunouchisController extends AppController
{
public function index()
{
$now = date("Y-m-d H:i:s");
$params = array(
'conditions' => array(
'forecast >' => $now,
),
);
$marunouchis = $this->Marunouchis->find('all', $params);
$this->set(compact('marunouchis'));
}
}
表示

おお、素晴らしい
index.ctpを一部改良
<h1>丸の内の天気</h1>
<table>
<tr>
<?php
$i = 1;
foreach ($marunouchis as $marunouchi){
echo "<td width=\"150px\">";
echo h($marunouchi->forecast). "<br>";
echo h($marunouchi->main)."<br>";
echo h($marunouchi->description)."<br>";
echo "気温".h($marunouchi->temp)."<br>";
echo "湿度". h($marunouchi->humidity)."%<br>";
echo "雲の量".h($marunouchi->cloud)."<br>";
echo "風速".h($marunouchi->speed)."m<br>";
echo "<td>";
if($i % 8 == 0){
echo "</tr><tr>";
}
$i++;
}
?>
</tr>
</table>
悲しくなってきた。
