日付の判定

$dateに格納されている日付('Y-m-d'形式)が、今から2週間前までのものかを判定する。

$y = substr( $date,0,4 );
$m = substr( $date,5,2 );
$d = substr( $date,8,2 );
$regDate = mktime(0,0,0,$m,$d,$y);
$criDate = date('Y-m-d', strtotime('-2 week',time()));
$y = substr( $criDate,0,4 );
$m = substr( $criDate,5,2 );
$d = substr( $criDate,8,2 );
$criDate = mktime(0,0,0,$m,$d,$y);
$ret[$key]['isNew'] = ($regDate>=$criDate); // $dateが今から2週間以内の日付なら isNew=true