in reply to How do I tell the time between two dates?
The link that Your Mother provided mentions Time::Piece. Here's one way to solve your problem using it.
Here's a good article describing how to use Time::Piece: http://perltricks.com/article/59/2014/1/10/Solve-almost-any-datetime-need-with-Time--Piece/#!/usr/bin/env perl use strict; use warnings; use Time::Piece; my $date_format = '%Y-%m-%d'; my $hiredate = Time::Piece->strptime('2014-05-05', $date_format ); my $nowdate = Time::Piece->strptime('2016-04-15', $date_format ); my $elapsed_seconds = $nowdate - $hiredate; my $elapsed_days = $elapsed_seconds/86400; print " Hire Date: $hiredate\n"; print " Now Date: $nowdate\n"; print " Elapsed Days: $elapsed_days\n"; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I tell the time between two dates?
by htmanning (Friar) on Apr 16, 2016 at 05:26 UTC | |
by Your Mother (Archbishop) on Apr 16, 2016 at 05:56 UTC | |
by kevbot (Vicar) on Apr 16, 2016 at 06:04 UTC |