Simple perpetual calendar function _ PHP Tutorial

Source: Internet
Author: User
Simple perpetual calendar function. A perpetual calendar function was required a few days ago. I saw a perpetual calendar on oso. The program function was powerful, but it was too cumbersome. I did not meet my own requirements, so I wrote one myself. I can also // a perpetual calendar function was required a few days ago. I saw a perpetual calendar on oso. The program function was powerful, but it was too cumbersome.
// Because it does not meet your own requirements, you can write one yourself and add a connection to the date!
Function calendar ($ year, $ moon ){
$ Moon1 = array ("01", "02", "03", "04", "05", "06", "07", "08 ", "09", "10", "11", "12 ");
$ Moon2 = array ("31", "28", "31", "30", "31", "30", "31", "31 ", "30", "31", "30", "31 ");
If ($ year-2000) % 4 = 0) {$ moon2 [1] = 29 ;}
For ($ I = 0; $ I <= 11; $ I ++ ){
If ($ moon1 [$ I] ==$ moon ){
$ Total = $ moon2 [$ I];
}
}
$ Out_chat = "";
$ Out_chat. = "May 15, 1234 ";
For ($ I = 1; $ I <= $ total; $ I ++ ){
$ J = $ I;
If ($ I <10 ){
$ J = "0". $ I;
}
$ Time_array = getdate (mktime (0, 0, 0, $ moon, $ j, $ year ));
If ($ I = 1 ){
Switch ($ time_array [wday]) {
Case "0 ":
$ Out_chat. = "". $ I ."";
Break;
Case "1 ":
$ Out_chat. = "". $ I ."";
Break;
Case "2 ":
$ Out_chat. = "". $ I ."";
Break;
Case "3 ":
$ Out_chat. = "". $ I ."";
Break;
Case "4 ":
$ Out_chat. = "". $ I ."";

Break;
Case "5 ":
$ Out_chat. = "". $ I ."";
Break;
Case "6 ":
$ Out_chat. = "". $ I ."";
Break;
}
} Else {
If ($ I! = $ Total ){
If ($ time_array [wday]! = 0 ){
$ Out_chat. = "". $ I ."";
} Else {
$ Out_chat. = "". $ I ."";
}
} Elseif ($ I ==$ total ){
Switch ($ time_array [wday]) {
Case "0 ":
$ Out_chat. = "". $ I ."";
Break;
Case "1 ":
$ Out_chat. = "". $ I ."";
Break;
Case "2 ":
$ Out_chat. = "". $ I ."";
Break;
Case "3 ":
$ Out_chat. = "". $ I ."";
Break;
Case "4 ":
$ Out_chat. = "". $ I ."";
Break;
Case "5 ":
$ Out_chat. = "". $ I ."";
Break;
Case "6 ":
$ Out_chat. = "". $ I ."";
Break;
}
}
}
}
$ Out_chat. = "";
Return $ out_chat;
}

$ Year = 2000;
$ Moon = 08;
$ Test = calendar ($ year, $ moon );
Echo $ test;
?>

Bytes. // It does not meet your requirements. Therefore, you can write one by yourself...

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.