Y2K - Year 19100 (with the patch)

greenspun.com : LUSENET : S-Mart Shopping Cart : One Thread

The get_date subroutine in both the smart.pl and smartadmin.pl needed to be modified (at least on the NT machine that I am using). The year came up as 19100.

I added two lines and modified the 19 to 20 in the $date calculation.

sub get_date { @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); @months = ('January','February','March','April','May','June','July', 'August','September','October','November','December');

($sec,$min,$hour,$mday,$mon,$year,$wday) = localtime(time); if ($hour < 10) { $hour = "0$hour"; } if ($min < 10) { $min = "0$min"; } if ($sec < 10) { $sec = "0$sec"; }

#y2k patch $year = $year - 100; if ($year < 10) { $year = "0$year"; }

$date = "$days[$wday], $months[$mon] $mday, 20$year at $hour\:$min\:$sec";

}

I do not understand enough about perl (yet) to understand why the year came back as 100 for 2000. But this solution fixed the code.

Joel

-- Joel (jdeneuf@nac.net), January 01, 2000

Answers

: )

-- Patrick Chan (patrickccf@hotmail.com), January 19, 2000.

Moderation questions? read the FAQ