Kevin,
The solution is not clear..Please can you elaborate more..
Hi Vinod,
What Kevin is trying to explain is this..
Suppose you have the two dates like this Date1 : 2007/12/26 and Date2: 2007/12/26..
You pass both these to the script thru command line like this
- perl scriptname.pl 2007/12/26 2007/12/26
And in the script, you can retrieve the same using the array @argv, which is used to manipulate the command line arguments
- #!usr/bin/perl
-
use strict;
-
use warnings;
-
my ($date1,$date2) = @ARGV;
-
-
Now the variables $date1 and $date1 will have the dates that you have entered thru the command line..
Now for converting the same to epoch seconds, use the Time:Local module like this
-
($year,$mon, $date) = split/\W+/, $date1;
-
$epoch_time = timelocal($date,$month,$year);
Now the timelocal() takes the month value as an integer, from 0-11.. so if you have to pass the month "December" you would be passing 11. so you have to modify the $month variable accordingly.