Shouldn't $mday be zero-justified as well? There should be one more line in there to make it consistent:
if ($mday < 10) { $mday = ''0$mday''; }
-Br.Bill
2008-05-02, 14:53:51
anonymous from United States
Several problems here:
1) $wday,$yday,$isdst should be 'undef,undef,undef', as they're not used and might throw a warning.
2) $mon needs to be incremented: $mon++; #january is 0, right?
3)
2008-08-07, 05:42:13
anonymous from Pakistan
Thanks for the post. Just an alternate of the same script:
sub get_timestamp {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
Hello,
In above code will show month as number -1.
Following code is varation of above
$unique_filename = 'filename_' . get_timestamp();
sub get_timestamp {
@abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
retu' $mday\_$abbr[$mon]\_$year\_$hour\_$min\_$sec';