SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : DAYTRADING Fundamentals

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: TraderAlan who wrote (6241)1/1/2000 6:17:00 PM
From: Jon Tara  Read Replies (1) of 18137
 
OT - TraderAlan your CGI Y2K bug sounds like some bad Perl programming... (Is it a Perl script?)

I've heard of a a similar case in the news - they only referred to it as a problem with a "scripting language", but I assume it is Perl.

There's nothing wrong with Perl, but there is something wrong with how some programmers have used it.

Perl uses 1900 as a base for the year. So, year 01 is 1901, year 99 is 1999, year 100 is 2000, year 101 is 2001, etc.

The proper way to format dates in Perl is to add 1900 to the retrieved year, then format into a string.

Some programmers have improperly formatted dates using a literal string "19" concatenated with the year. Of COURSE, they had to know that this was going to break, but imagine their surprise when it breaks showing "19100" instead of "1900"!

And if you want to format a 2-digit year in Perl, you should take the modulo 100 of the year.
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext