in reply to need help with comparing time..
#! /usr/bin/perl use warnings; use strict; use Time::Piece; my $last_modified = 'Time::Piece'->strptime('2015-05-20 03:52:13', '%Y +-%m-%d %H:%M:%S'); my $diff = -($last_modified - localtime) / 60 / 60; print $diff < 12 ? 'less' : 'more (or equal)', " than 12 hours\n";
See also DateTime and Date::Manip.
|
|---|