in reply to How to convert mtime using strftime() in perl
strftime needs a list of values. You call localtime in scalar context, making it return just a pre-formatted string version of the time. Either use an array to hold the return value
my @systime = localtime( $mtime ); my $str = strftime( "%a %b %e %H:%M:%S %Y", @systime );
or call localtime when you call strftime
my $str = strftime( "%a %b %e %H:%M:%S %Y", localtime( $mtime ) );
|
|---|