PHP Calender (Desk calendar) code

Source: Internet
Author: User
PHP Calender (Calendar) code
 = 2038) {$year = date (' Y ');        }} else {if ($year <= 0) {$year = date (' Y ');    }} if ($month <= 0 or $month >) {$month = date (' m ');    }//Previous year $pretYear = $year-1;    Last month $mpYear = $year;    $preMonth = $month-1;        if ($preMonth <= 0) {$preMonth = 1;    $mpYear = $pretYear;    }//Next year $nextYear = $year + 1;    Next month $mnYear = $year;    $nextMonth = $month + 1;        if ($nextMonth >) {$nextMonth = 1;    $mnYear = $nextYear; }//Calendar header $html = <<
       Last year    Last month     Back to today    Next month    Next year        {$year} year {$month} month                  
  
 HTML; $currentDay = Date (' Y-m-j '); Last day of the month $lastday = Date (' J ', Mktime (0, 0, 0, $nextMonth, 0, $year)); Cycle output days $day = 1; $line = "; while ($day <= $lastday) {$cday = $year. '-' . $month. '-' . $day; Current day of the Week $nowWeek = Date (' N ', mktime (0, 0, 0, $month, $day, $year)); if ($day = = 1) {$line = ' 
   
     '; $line. = Str_repeat (' 
    ', $nowWeek-1); } if ($cday = = $currentDay) {$style = ' style= ' color:red; ';} else {$style = '; } $line. = " 
    "; End of Week if ($nowWeek = = 7) {$line. = ' 
   '; $html. = $line; $line = ' 
   
     '; }//All month End if ($day = = $lastday) {if ($nowWeek! = 7) {$l ine. = Str_repeat (' 
    ', 7-$nowWeek); } $line. = ' 
   '; $html. = $line; Break } $day + +; } $html. = << 
  
Monday Tuesday Wednesday Thursday Friday Saturday Sunday
$day
HTML; return $html;} /** * * Detection is 32-bit machine * @author Fc_lamp * @blog: fc-lamp.blog.163.com */function is32 () {$is = False; if (Strtotime (' 2039-10-10 ') = = = False) {$is = True; } return $is 32;}

  

  • 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.