Y2k compliant?

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

The below extract from sub get_date appears not to be Year 2000 compliant with the two digits placed in front of $year being 19 .

# Get the date. sub get_date {

......

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

........

}

Anyone have any suggestions for fixing this?

-- William Kolln (wkolln@cia.com.au), April 19, 1998

Answers

Well I suppose if I ask a stupid question I'll the appropriate reply. Thanks to a bright, bright spark who suggested to change the 19 to 20 when the year 2000 comes around...!!! I'm afraid the entire matter seems to be missed with that response. It is my understanding from reading "Perl by Example" by Ellie Quigley (a noted PERL tutor) that $year returns the number of years since 1900. Therefore simply placing 20 in front of $year would not probably produce the correct desired outcome but rather 20100. Therefore my question this time, is this: Is $year set to read the number of years since 2000 if the 19 in front of it is changed to 20 when the year 2000 comes along.

-- William Kolln (wkolln@cia.com.au), April 20, 1998.

If it is true that $year is the number of years since 1900, then all you would have to do is:
1. change the "19" to "20"
2. Subtract 100 years off $year eg. $year = ($year-100);

-- Nathan Morris (nathan@velvetempire.com), March 16, 1999.

The localtime routine used in s-mart is Y2K compliant. On the first of Jan the server will return 100 instead of 99. So 1900 + 100 =2000. Next year the server will return 101 and, 1900 + 101= 2001. Nothing has to be changed whatsoever. I made the mistake myself not too long ago and wrote a UNIX/LINUX shell script to replace the PERL localtime function. (It worked perfectly, but it wasn't necessary). I got an email from Lincoln Stein himself. (Humility doesn't hurt !) Barry was kind enough to remove the allert. Thanks

-- Gregory Swofford (computer@web-store.net), May 28, 1999.

Try

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

This should be the easiest way to make it y2k-compliant

-- lutz (b.lutz@online.de), September 13, 1999.


My result form had 19100. The following will fix it until 2010. It works for me. $years = ($year-100); $date = "$days[$wday], $months[$mon] $mday, 200$years at $hour\:$min\:$sec";

-- Eddie Deboard (eddie@writeme.com), January 01, 2000.


I see this message board changed my last posting. View the source of this page to see the code I actually typed.

-- Eddie Deboard (eddie@writeme.com), January 02, 2000.

Moderation questions? read the FAQ