in reply to localtime - make the date format different?

Use a split using \s as the separator or u can also use =~ s/\s/-/, $date
Njoi
Raghu
  • Comment on Re: localtime - make the date format different?

Replies are listed 'Best First'.
Re^2: localtime - make the date format different?
by ultranerds (Hermit) on Dec 22, 2008 at 10:21 UTC
    haha always the simple things :D
    my @stats = stat("$folder/$file"); my @date = split / /, localtime $stats[9]; my $date = qq|$date[4] $date[1] $date[2] $date[3]|;


    Thanks for the tip =)

    Cheers

    Andy

      That won't work correctly at the beginning of the month.

      $ perl -le' my @date = split / /, localtime 1228636800; print qq|$date[4] $date[1] $date[2] $date[3]|; ' 00:00:00 Dec 7