Re: Time Comparison Easier Than I'm Making them
- From: mritty@xxxxxxxxx (Paul Lalli)
- Date: Wed, 28 Nov 2007 07:46:37 -0800 (PST)
On Nov 28, 9:50 am, theill...@xxxxxxxxx (Mathew Snyder) wrote:
I've got an application which uses the format yyyy-mm-dd hh:mm:ss for its
timestamping. I'm trying to determine if the time a record was created was 5 or
more minutes before the time the script runs. Using DateTime->now I get a
timestamp of yyyy-mm-ddThh:mm:ss. I have no clue what the 'T' represents.
All I'm trying to do is take the hh:mm:ss portion of each timestamp and find the
difference yet I'm pulling my hair out trying to find the solution. Can someone
please just point me to what I can use? I'll figure it out from there.
use Time::Local;
my $record = '2007-11-28 10:43:30";
my ($y, $m, $d, $h, $i, $s) = split /[-: ]/, $record;
my $ts = timelocal($s, $i, $h, $d, $m-1, $y-1900);
my $now = time();
if (($now - $ts) > 300) {
# $record is more than five minutes ago
}
__END__
Paul Lalli
.
- References:
- Time Comparison Easier Than I'm Making them
- From: Mathew Snyder
- Time Comparison Easier Than I'm Making them
- Prev by Date: Re: Time Comparison Easier Than I'm Making them
- Next by Date: Re: fixed list combinatorics
- Previous by thread: Re: Time Comparison Easier Than I'm Making them
- Next by thread: Re: Time Comparison Easier Than I'm Making them
- Index(es):
Relevant Pages
|