Date::Holidays::CN - Determine Chinese public holidays


Date-Holidays-CN documentation  | view source Contained in the Date-Holidays-CN distribution.

Index


NAME

Top

Date::Holidays::CN - Determine Chinese public holidays

SYNOPSIS

Top

    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 = '中秋节'

EXPORT

Top

is_cn_holiday( $year, $month, $day )

determine whether that day is a Chinese holiday

cn_holidays($year)

BE CAREFUL! It only provide solar calendar for now! And it's not suggested!

EXPORT_OK

Top

SUGGESTED! quicker and more elegant!

is_cn_solar_holiday( $year, $month, $day )

determine whether that day is a Chinese holiday by the Gregorian calendar/solar calendar

is_cn_lunar_holiday( $year, $month, $day )

determine whether that day is a Chinese holiday by the Chinese calendar/lunar calendar

RETURN VALUE

Top

if it is a holiday, return the Chinese holiday name(utf8), otherwise return undef.

AUTHOR

Top

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

Top


Date-Holidays-CN documentation  | view source Contained in the Date-Holidays-CN distribution.