POSIX::strftime
POSIX::strftime
(OP)
Hi
I am trying to configure a Bug Tracking program that is written in Perl and want to get the dates to format differently.
These are the lines of code in one of the PERL Modules that I want to change...
sub now {
my $now = POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime);
return $now;
}
What I want to return is a date in the format of (dd-mm-yyyy)..
my $now = POSIX::strftime("%d-%m-%Y %H:%M:%S", localtime);
But this just fails. Can anyone help?
I am trying to configure a Bug Tracking program that is written in Perl and want to get the dates to format differently.
These are the lines of code in one of the PERL Modules that I want to change...
sub now {
my $now = POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime);
return $now;
}
What I want to return is a date in the format of (dd-mm-yyyy)..
my $now = POSIX::strftime("%d-%m-%Y %H:%M:%S", localtime);
But this just fails. Can anyone help?
RE: POSIX::strftime
$ perl -MPOSIX -e 'print POSIX::strftime("%d-%m-%Y %H:%M:%S", localtime),"\n"'
03-02-2004 11:21:07
RE: POSIX::strftime
(@date)=localtime;
$date[5]+=1900;$date[4]++;
$now=sprintf("%0.2d-%0.2d-%0.4d %0.2d:%0.2d:%0.2d",$date[3],$date[4]++, $date[5], $date[2],$date[1],$date[0]);
print "$now";
HTH
--Paul
RE: POSIX::strftime
sub now {
my $now = POSIX::strftime("%d-%m-%Y %H:%M:%S", localtime);
return $now;
}
All i get is.......
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification (SQL-22018)(DBD: st_execute/SQLExecute err=-1) at lib/dbase.pm line 78.
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification (SQL-22018)(DBD: st_execute/SQLExecute err=-1) at lib/dbase.pm line 78.
RE: POSIX::strftime
RE: POSIX::strftime
This will work:
my $now = POSIX::strftime("%Y-%m-%d %H:%M:%S", localtime);
But this throws an error!
my $now = POSIX::strftime("%d-%m-%Y %H:%M:%S", localtime);
RE: POSIX::strftime
RE: POSIX::strftime
RE: POSIX::strftime
Unfortunately, I cannot verify this by testing it as I cannot reboot the server.
RE: POSIX::strftime
RE: POSIX::strftime
RE: POSIX::strftime