Fayland 林 > Date-Holidays-CN-0.01 > Date::Holidays::CN

Download:
Date-Holidays-CN-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

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

SYNOPSIS ^

    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 ^

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 ^

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 ^

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

AUTHOR ^

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE ^

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.

syntax highlighting: