bazz
10-25-2008, 08:10 PM
Hi,
resolved it with Date:Calc qw(:all);
I am converting a date (20081012) to October 2008. Well I have tried.
my $timestamp = build_timestamp ($fileStartDate);
my $date_to_output = date_conversion($timestamp);
sub date_conversion {
use Date::Parse;
my $timestamp = shift;
#strftime uses "%a %b %d %H:%M:%S %Z %Y".
my $finished_date = strftime("%a %Z %Y",$timestamp);
return $finished_date;
}
# build a unix timestamp
sub build_timestamp {
my $iso_date = shift;
# parse and convert date to unix time
my $timestamp = str2time($iso_date);
my $newtimestamp = ($timestamp/86400);
return $newtimestamp;
}
Unfortunately, I get this error and I don't understand it.
Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) at mainpage line 446, <DAT> line 21
Please give me a nudge.
bazz
resolved it with Date:Calc qw(:all);
I am converting a date (20081012) to October 2008. Well I have tried.
my $timestamp = build_timestamp ($fileStartDate);
my $date_to_output = date_conversion($timestamp);
sub date_conversion {
use Date::Parse;
my $timestamp = shift;
#strftime uses "%a %b %d %H:%M:%S %Z %Y".
my $finished_date = strftime("%a %Z %Y",$timestamp);
return $finished_date;
}
# build a unix timestamp
sub build_timestamp {
my $iso_date = shift;
# parse and convert date to unix time
my $timestamp = str2time($iso_date);
my $newtimestamp = ($timestamp/86400);
return $newtimestamp;
}
Unfortunately, I get this error and I don't understand it.
Usage: POSIX::strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1) at mainpage line 446, <DAT> line 21
Please give me a nudge.
bazz