Re: Time Comparison Easier Than I'm Making them



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.

use Date::Parse;
my $rectime = str2time '2007-11-28 16:40:11';
print $rectime + 300 <= time ? '5 or more' : 'Less than 5',
" minutes\n";

All I'm trying to do is take the hh:mm:ss portion of each timestamp and find the
difference

What if the record was created at 23:58?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages

  • Re: Time Comparison Easier Than Im Making them
    ... Mathew Snyder wrote: ... timestamping. ... more minutes before the time the script runs. ... ....it will strip the T: ...
    (perl.beginners)
  • Re: simple perl script on Windows
    ... Mathew Snyder wrote: ... and each entry is like thus: ... I then created a simple script that I hoped would eliminate everything ... prior to the last bit of text which follows the big space. ...
    (perl.beginners)
  • Re: HTML::TokeParser question
    ... Mathew Snyder wrote: ... > I have a script which runs WWW::Mechanize to obtain a page so it can be parsed ... scalar reference. ... return value from the constructor would have shown your problem. ...
    (perl.beginners)
  • Re: Time Comparison Easier Than Im Making them
    ... timestamping. ... more minutes before the time the script runs. ... difference yet I'm pulling my hair out trying to find the solution. ... Paul Lalli ...
    (perl.beginners)