#!/usr/bin/perl -w use warnings; use strict; use Getopt::Long; use Time::Local; use POSIX qw(strftime); # The idea is to take an input date and add 6 days to it. # It seems to work except when the start date is November 1! # # Below is an example: # my $input_date; GetOptions("start_date=s" => \$input_date); print "\nWe expect a start day and a day 6 days later than that!\n"; my @date_pieces = split('/',$input_date); my $start_day = timelocal(0, 0, 0, $date_pieces[1], $date_pieces[0]-1, $date_pieces[2]); my $end_day = $start_day + 6*24*60*60; my $new_start_day = strftime "%m/%d/%Y", (localtime($start_day)); my $new_end_day = strftime "%m/%d/%Y", (localtime($end_day)); print "The start day is $new_start_day and the end day is $new_end_day\n";