PHP Simple Calendar Implementation program Code _php tutorial

Source: Internet
Author: User
About the application of the calendar, should be on the independent blog above can be very well reflected, whether it is php WP blog, or ASP z_blog blog, have applied the function of the calendar, that is, the log archive, we want to see the previous release of the log, as long as the log to bring up the archive, will be able to view each article very clearly.

Because recently write a calendar of the project function, so naturally think of the log archive, in fact, the implementation of such a function is not difficult, the first to have a calendar of the form to visualize the calendar, and the processing date of time is given to the programming code, such as PHP, to see the previous written document, that is, the calendar is turned forward, Then you need to submit the calendar time and then hand it over to the form to show it.

Effect

Below is a novice to do the PHP calendar function, here with a file to write the function of the calendar, the file is not very large, there is a comment, is a simple principle function, the acceptance of the part is handled by PHP, the display part of the table, if you do PHP calendar project can be directly two times to develop can be used.

The code is as follows Copy Code

Stripping Date
Date_default_timezone_set ("Asia/harbin");
$riqi =getdate ();
$nian = $riqi [' Year '];
$yue = $riqi [' mon '];
$ri = $riqi [' Mday '];
$hour = $riqi [' hours '];
$min = $riqi [' minutes '];
$miao = $riqi [' seconds '];
Form judgment
if (Isset ($_get["Yue")) {
$yue =intval ($_get["Yue"]);
}
if (Isset ($_get["Nian")) {
$nian =intval ($_get["Nian"]);
}
One months and days
$tianshu =date (' t ', Mktime (0,0,0, $yue, 1, $nian));
The first day of the month
$yuez =date (' W ', Mktime (0,0,0, $yue, 1, $nian));
$tian = 0;
?>
































Calendar now time:
Day One Two Three Four Five Six
"Align=" Center >
if ($h * $l <= $yuez && $h ==1) {
Echo ';
}elseif ($tian < $tianshu) {
echo + + $tian;
}else{
Echo ';
}
?>


&yue= "> Last year
&yue= "> next year


&nian= ">
if ($yue -1<=0) {
Echo ' < '. 12 ';
}else{
Echo ' < '. ($yue-1);
}
?> Month


{echo ' 1 ';} Else{echo $yue +1; >&nian= ">
if ($yue +1>12) {
echo ' 1 ';
}else{
echo $yue +1;
}?> month >



http://www.bkjia.com/PHPjc/632706.html www.bkjia.com true http://www.bkjia.com/PHPjc/632706.html techarticle about the application of the calendar, should be on the independent blog above can be well reflected, whether it is php WP blog, or ASP z_blog blog, have applied the function of the calendar, that is the day ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.