in reply to Using Time::Piece and ISO8601

Hi. Maybe you can incorporate something like this:
#!/usr/bin/env perl use strict; use warnings; use feature 'say'; use DateTime; my $date_in = "myfile-b2291ce2b21d1cf6f6af68bd3e355505-20120112T115534 +"; my ($year, $month, $day ) = $date_in =~ m| myfile- .* - ( \d{4} ) ( \d +{2} ) ( \d{2} ) T \d{6} |x; my $now = DateTime->now; my $record = DateTime->new( year => $year, month => $month, day => $day, ); my $duration = $now->delta_days($record)->in_units('days'); #just reporting stuff to make sure all is well say "Now is: $now"; say "The record was: $record"; say "The record is $duration days old..."; say "Too old!" if $duration > 30;

The output:

Now is: 2012-06-22T01:55:10 The record was: 2012-01-12T00:00:00 The record is 162 days old... Too old!

Replies are listed 'Best First'.
Re^2: Using Time::Piece and ISO8601
by gossamer (Sexton) on Jun 25, 2012 at 18:36 UTC
    That's awesome. Thanks so much for spending the time to help.

    Thanks,
    Alex