The hour must be in 24-hour format. You don't have to use the hour, minute, and second if you just want to compare the date and not the time.my $comparetodate = 20020220194516; # This would probably be taken fro +m a database or something. my ($sec, $min, $hour, $mday, $mon, $year) = localtime; my $date = sprintf "%04d%02d%02d%02d%02d%02d",$year+1900,$mon+1,$mday, +$hour,$min,$sec; print "Content-type: text/html\n\n"; if ($date > $comparetodate) { print "Right now is after the archived date."; } else { print "Right now is before the archived date."; }
-joshua
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Comparing Dates
by grep (Monsignor) on Feb 21, 2002 at 02:25 UTC | |
|
Re: Comparing Dates
by lachoy (Parson) on Feb 21, 2002 at 03:22 UTC | |
by metadoktor (Hermit) on Feb 21, 2002 at 07:49 UTC | |
by lachoy (Parson) on Feb 21, 2002 at 12:43 UTC | |
|
Re: Comparing Dates
by mortis (Pilgrim) on Feb 21, 2002 at 05:03 UTC |