Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

6.7. Date::Manip

		
use Date::Manip;

sub _time_limit {
    my ($self, $date, $limit) = @_;
    my $now = localtime(time());
    my $current_date = ParseDate($now);
    my $pub_date = ParseDate($date);
    my $limit_date = DateCalc($current_date, "-$limit month");
    $pub_date =~ s/\:.*$//;
    $limit_date =~ s/\:.*$//;
    if ($pub_date > $limit_date) {
        return 1;
    }else{
        return 0;
    }