Perl date difference which are in different formats -
Perl date difference which are in different formats -
i have 2 dates below in perl code-
my $asof_date; chomp($asof_date = `date +'%m/%d/%y'`);
and date coming sql table - $date = $syb_row[3];
here $date in form of "dec 20 2013 12:00am"
now help calculate maturity-where maturity difference in days between 2 dates(i.e $asof_date & $date in above case) divided 365.
and yes have limited module installed parsedate not installed.
thanks in advance.
use strict; utilize warnings; utilize datetime; utilize datetime::format::strptime; ...; $db_parse = datetime::format::strptime->new( pattern => '%b %d %y %r%p', locale => 'en_us', time_zone => 'america/new york', ### olson tz name ); $asof_date = datetime->now(time_zone => 'local'); $db_date = $db_parse->parse_datetime($syb_row[3]); $maturity = $asof_date->delta_days($db_date)->days / 365;
perl
Comments
Post a Comment