/************************************************
　その日まであと何日を表示するカスタムブロック
 ************************************************/


// toYear/toMonth/toDayまでの日数 を数えます
// 例）2012年12月25日
// $toYear = 2012;
// $toMonth = 12;
// $toDay = 25;

/* ここに指定したい日付を入れる */
$toYear = 2012;
$toMonth = 12;
$toDay = 25;

$toTime1=mktime(0,0,0,$toMonth,$toDay,$toYear);
$currentTime=mktime(0,0,0,date("m"),date("d"),date("Y"));

/* 以下はデバッグ用の表示です。見てみたい場合は頭の//を外してみてね */
//$toDay1=date("Y-m-d",$toTime1);
//$currentDate=date("Y-m-d",$currentTime);
//echo "<br>day1=".$toDay1;
//echo "<br>今日=".$currentDate;

$atoDay=($toTime1-$currentTime)/86400;

/* おまけ もう一つの日まで何日か？ */
/* 1つで良い場合はしていなくてOKです */
$toYear2 = 2013;
$toMonth2 = 1;
$toDay2 = 1;
$toTime2=mktime(0,0,0,$toMonth2,$toDay2,$toYear2);
$atoDay2=($toTime2-$currentTime)/86400;

?>
<div style="background:#ffff99;text-align:center;padding-top:10px;padding-bottom:10px;width:100%;border:dotted 3px #00ff00;">
<div>クリスマスまであと　<?php echo $atoDay;?>　日！</div>
<div style="font-size:0.6em;margin-top:5px;">お正月まであと　<?php echo $atoDay2;?>　日！</div>
</div>