Php calendar code sharing simple and practical php calendar code

Source: Internet
Author: User
Php calendar code sharing simple and practical php calendar code

  1. Header ("content-type: text/html; charset = utf-8 ");
  2. ?>
  3. /**
  4. * Simple and practical php calendar code
  5. * Edit: bbs.it-home.org
  6. */
  7. If (! Emptyempty ($ _ GET )){
  8. $ Year = $ _ GET ['Year'];
  9. $ Month = $ _ GET ['month'];
  10. }
  11. If (emptyempty ($ year )){
  12. $ Year = date ('Y ');
  13. }
  14. If (emptyempty ($ month )){
  15. $ Month = date ('M ');
  16. }
  17. $ Start_weekday = date ('W', mktime (0, 0, 0, $ month, 1, $ year ));
  18. // Echo $ start_weekday;
  19. $ Days = date ('t', mktime (0, 0, 0, $ month, 1, $ year ));
  20. // Echo $ days;
  21. $ Week = array ('Sunday', 'Monday', 'Tuesday', 'weday', 'thurs', 'Friday', 'satur ');
  22. $ I = 0;
  23. $ K = 1;
  24. $ J = 0;
  25. Echo'
  26. Echo'
  27. Echo'
  28. For ($ I = 0; $ I <7; $ I ++ ){
  29. }
  30. Echo'
  31. For ($ j = 0; $ j <$ start_weekday; $ j ++ ){
  32. }
  33. } Else {
  34. }
  35. }
  36. $ J ++;
  37. Echo"
  38. Echo"
  39. Echo'
  40. Echo"
  41. Echo"
  42. Echo'
  43. Echo'
  44. Echo'
  45. Echo'
  46. Echo'
  47. While ($ k <= $ days ){
  48. If ($ k = date ('D ')){
  49. Echo'
  50. Echo'
  51. If ($ j + 1) % 7 = 0 ){
  52. Echo'
  53. $ J ++;
  54. $ K ++;
  55. }
  56. While ($ j % 7! = 0 ){
  57. Echo'
  58. }
  59. Echo'
  60. Echo'
  61. '; '; '; '; '; '; '; '; '; '; '; '; '; '; '; '; '; '; ';
    '. $ Year. 'year'. $ month. 'month '.'
    '. $ Week [$ I].'
    '. $ J .''. $ K .''. $ K .'
    '. $ J .'
    ". '<'.'". '<'.'';
  62. Echo '';
  63. Echo'
  64. ". '> '.'". '> '.'
    ';
  65. Function lastYear ($ year, $ month ){
  66. $ Year = $ year-1;
  67. Return "year = $ year & month = $ month ";
  68. }
  69. Function lastMonth ($ year, $ month ){
  70. If ($ month = 1 ){
  71. $ Year = $ year-1;
  72. $ Month = 12;
  73. } Else {
  74. $ Month --;
  75. }
  76. Return "year = $ year & month = $ month ";
  77. }
  78. Function nextYear ($ year, $ month ){
  79. $ Year = $ year + 1;
  80. Return "year = $ year & month = $ month ";
  81. }
  82. Function nextMonth ($ year, $ month ){
  83. If ($ month = 12 ){
  84. $ Year = $ year + 1;
  85. $ Month = 1;
  86. } Else {
  87. $ Month ++;
  88. }
  89. Return "year = $ year & month = $ month ";
  90. }
  91. ?>

>>> Articles you may be interested in: php calender calendar code (solving 2038 issues) php calendar code (with demo effect) php calendar code php efficient calendar code php calendar code three good php calendar code share a PHP simple calendar code php simple calendar implementation code (events can be bound)

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.