#!/usr/bin/perl use strict; use warnings; use Time::Local; my $seconds = 0; my $minutes = 0; my $hours = 0; my $day = 14; my $month = 7; my $year = 2016; my $epoch_from = timelocal($seconds||0, $minutes||0, $hours||0, $day, $month-1, $year-1900); my $epoch_target = timelocal(0, 0, 0, 1, 8-1, 2016-1900); print secToTimeString0( $epoch_target - $epoch_from ); # This will give you an estimate of time. Used with -'"%;"' sub secToTimeString0 { my($t) = @_; my $s= ($t<0 && ($t*=-1))? '-':''; # return sprintf("$s%2d seconds", $t) if ($t < 60); $t /=60; #return sprintf("%s%2.2f minutes", $s, $t) if ($t < 60); $t /=60; #return sprintf("%s%2.2f hours", $s, $t) if ($t < 24); $t /=24; return sprintf("%s%2.2f days", $s, $t) ;#if ($t < 30); # $t /=30; return sprintf("%s%2.2f months", $s, $t) if ($t < 12); # $t /=12; return sprintf("%s%2.2f years", $s, $t); } #### my $days = int(0.5 + ( $epoch_target - $epoch_from ) /60/60/24 );