Php simple calendar implementation code _ PHP Tutorial

Source: Internet
Author: User
Php simple calendar implementation program code. The calendar application should be well reflected in the independent blog. both the wp blog in php and the z_blog blog in ASP have applied the calendar function, that is, the daily calendar application should be well reflected in the independent blog. both the wp blog of php and the z_blog blog of ASP have applied the calendar function, that is, the log is archived. when we want to view the previously released logs, we can view each article clearly by calling out the log archive.

Because I recently wrote a calendar project function, I naturally thought of archiving logs. In fact, it is not very difficult to implement this function. first, I need to have a calendar form to intuitively display the calendar, the time for processing the date is handed over to the programming code, such as PHP. to view the previous documents, that is, to flip the calendar forward, you need to submit the calendar time, then, it is displayed in the form.

Effect

The following is a new PHP calendar function. here, a file is used to write the calendar function. the file is not very large and there is a comment. it is a simple principle function, the ACCEPT part is handled by PHP, and the display part uses tables. if you are using a PHP calendar project, you can directly perform secondary development.

The code is as follows:

// Peel off date
Date_default_timezone_set ("Asia/Harbin ");
$ Riqi = getdate ();
$ Nian = $ riqi ['Year'];
$ Yue = $ riqi ['mon'];
$ Ri = $ riqi ['mday'];
$ Hour = $ riqi ['urs'];
$ Min = $ riqi ['minutes '];
$ Miao = $ riqi ['seconds'];
// Form judgment
If (isset ($ _ GET ["yue"]) {
$ Yue = intval ($ _ GET ["yue"]);
}
If (isset ($ _ GET ["nian"]) {
$ Nian = intval ($ _ GET ["nian"]);
}
// Several days a month
$ Tianshu = date ('t', mktime (0, 0, 0, $ yue, 1, $ nian ));
// Day of the week on the first day of the month
$ Yuez = date ('W', mktime (0, 0, 0, $ yue, 1, $ nian ));
$ Tian = 0;
?>
































Calendar Current time:
Day I II 3. Thu V. Sat.
"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


12) {echo '1';} else {echo $ yue + 1 ;}?> & Nian = ">
If ($ yue + 1> 12 ){
Echo '1 ';
} Else {
Echo $ yue + 1;
}?> Month>



The wp blog of ghost php and the z_blog blog of ASP all apply the calendar function, that is, the day...

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.