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 ~