in reply to Date format

Try This
my($min,$hour,$day, $month, $year,$wday) = (localtime)[1,2,3,4,5,6]; if ($year < 70){$year += 2000;}else{$year += 1900;} my @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday +','Saturday'); my @month_array =('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug +','Sep','Oct','Nov','Dec'); print "$days[$wday], $month_array[$month] $day, $year $hour:$min";
Rds/Praveen

Replies are listed 'Best First'.
Re^2: Date format
by davorg (Chancellor) on Feb 15, 2006 at 11:05 UTC
    if ($year < 70){$year += 2000;}else{$year += 1900;}

    Whoa! where did that come from? You really need to read the documentation for localtime. The year value that you get back is always the number of years since 1900. You never need to add 2000 to the year - it's always 1900.

    Of course you'll never come across that bug if you're calling localtime without any arguments as the year you'll get now will always be over 100. But you really don't want to be leaving potential bugs like that around in code that you're giving people as an example.

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg