SPUG: epoch date

luis medrano lmzaldivar at gmail.com
Thu Apr 13 10:53:02 PDT 2006


Hey list,

I'm trying to convert dates to epoch dates but my script is giving me 
this error: "Day '29' out of range 1..28 at date.pl line 13". Any of
you may know what it can be wrong?,

Thanks,
Luis

P.S. This is the script:


#!/usr/bin/perl
use strict;
use Time::Local;
my @months=('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
my $sec=00;
my $min=00;
my $hours=14;
my $mon=1;
my $year=2005;
foreach my $month (@months){
        for (my $day=1; $day<=29;$day++){
                #next if (($month == $months[1]) && ($day>28));
                my $epoch=timelocal($sec, $min, $hours, $day, $mon, $year);
                print" $epoch, $day, $mon, $year \n";
        }
$mon++;
}


but I


More information about the spug-list mailing list