当前位置:编程学习 > php >>

PHP简单日历实例

<?php
/*
 * PHP简单日历实例
 * 作者: 多菜鸟
 * 邮箱: kingerq AT msn DOT com
 * 来源: http://blog.csdn.net/kingerq/
 * 创建时间: 2008-01-03
**/

$date = preg_match("/d{4}-d{2}-d{2}/", $_GET["YMD"]) ? $_GET["YMD"] : date( "Y-m-d" );
$thisYear = date( "Y", strtotime( $date) );
$thisMonth = date( "m", strtotime( $date) );
$firstDay = date( "w", strtotime( $thisYear."-".$thisMonth."-01" ) );
$monthNum = date( "t", strtotime( $date) );
?>
<html>
<head>
<title>Calendar</title>
<style type="text/css">
.datehead td{
  background-color: #669966;
  border: 1px solid #4F774F;
  color:#FFFFFF;
  height:30px;
  font-size:18px;
  font-weight:bold;
  text-align:center;
  font-family: Geneva, Arial, Helvetica, sans-serif;
}
.daynormalbg td{
 background-color:#EEEEEE;
 border:solid #dddddd 1px;
 height:100px;
 vertical-align: top;
 width:14%;
}
.daynormalfont div{
 color:#000000;
 font-weight:bold;
 font-size:18px;
 font-family: Geneva, Arial, Helvetica, sans-serif;
}
.sunday{color:#CC0000 !important; }
.saturday{color: #006600 !important;}
.todaybg{
 background-color:#0099FF !important;
 text-decoration: underline;
}
a {font-family:Geneva, Arial, Helvetica, sans-serif; color:#333333; font-size:12px}
a:hover{text-decoration:none;}
</style>
</head>

<body>
<table border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td>     
 <p><a href="?YMD=<?=date( "Y-m", strtotime( $date." -1 year") )."-01"?>"><<Last Year</a>
        <a href="?YMD=<?=date( "Y-m",

补充:Php教程,Php常用代码 
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,