Date::Holidays::CN - Determine Chinese public holidays
use Date::Holidays::CN; my ($year, $month, $day) = (localtime)[ 5, 4, 3 ]; $year += 1900; $month += 1; if (my $holidayname = is_cn_holiday( $year, $month, $day )) { print "这是个 $holidayname"; } my $h = cn_holidays($year); printf "10 月 1 日是 '%s'\n", $h->{'1001'}; # suggested use Date::Holidays::CN qw/is_cn_solar_holiday is_cn_lunar_holiday/; my $holidayname = is_cn_solar_holiday( 2005, 10, 1 ); # $day = '国庆节' my $is_holiday = is_cn_lunar_holiday( 2005, 9, 18 ); # $day = '中秋节'
determine whether that day is a Chinese holiday
BE CAREFUL! It only provide solar calendar for now! And it's not suggested!
SUGGESTED! quicker and more elegant!
determine whether that day is a Chinese holiday by the Gregorian calendar/solar calendar
determine whether that day is a Chinese holiday by the Chinese calendar/lunar calendar
if it is a holiday, return the Chinese holiday name(utf8), otherwise return undef.
Fayland Lam, <fayland at gmail.com>
<fayland at gmail.com>
Copyright 2005 Fayland Lam, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Date::Holidays::CN, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Date::Holidays::CN
CPAN shell
perl -MCPAN -e shell install Date::Holidays::CN
For more information on module installation, please visit the detailed CPAN module installation guide.