Example Analysis of PHP date and holiday conversion

Source: Internet
Author: User
A PHP date and holiday conversion class, convert the Gregorian calendar into a lunar calendar, the lunar calendar into the Gregorian calendar, get the Ganzhi years, according to the lunar year to obtain the Lunar New Year, the number of days of the Chinese calendar, calculate the lunar calendar date and the day of the month, based on the number of days from the month of the lunar calendar.

Step one: Download the PHP date and Holiday conversion class library that we need to use in this lesson: http://www.php.cn/xiazai/leiku/511

The second step: After the download is complete, find the PHP class file, unzip to the local server, create a new PHP file!

Step Three: We call this class in this new file, and instantiate this class:

<?phpinclude_once "date1.php";//Introduce class file $obj = new Lunar;        Instantiate $year=2017; $month =8; $date =21;print_r ($obj->convertsolartolunar ($year, $month, $date));//convert Gregorian to lunar calendar//print_ R ($obj->convertsolarmonthtolunar ($year, $month))//print_r ($obj->convertsolarmonthtolunar ($year, $month)) ;//print_r ($obj->convertlunartosolar ($year, $month, $date));//Convert the lunar calendar to the Gregorian//print_r ($obj->getlunaryeardays ($ year);//print_r ($obj->getlunarbybetween ($year, 5));? >


The results of the operation are as follows:

Attention:

> Here we have a way to do it, and the rest of the partners can try it on their own ~

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.