in reply to Detecting 1 day ago
If you insist on a Perl way and as it looks, your date is in ISO 8601 format (YYYY-MM-DD HH:MM:SS) you can dervive the date stamp for 24 hours ago and do a string comparison
I love ISO 8601 dates for this feature.#!/usr/bin/perl use strict; use warnings; use POSIX; my $one_day = (24 * 60 * 60); while (<DATA>) { chomp; my $day_ago = strftime "%Y-%m-%d %H:%M:%S", localtime (time - $on +e_day); print "$_ is ", ( $_ gt $day_ago ? "recent" : "old" ) , $/; } __DATA__ 2005-23-02 02:02:02 2006-02-25 15:52:35
Cheers,
R.
Pereant, qui ante nos nostra dixerunt!
In Section
Seekers of Perl Wisdom