Gossamer Forum
Home : General : Perl Programming :

Will Y2K effect CGi scripts?

Quote Reply
Will Y2K effect CGi scripts?
Will the year 2000 thing mess up CGI scripts that run on date, like Links 2? I think I know how to fix it tell me if I am right:
Quote:
All you do is change the $year = 1900 + $year; to $year = 2000 + $year;
Please tell me if I am right. And if you dont change it will it mess up the files it is running or will it just show the wrong date?

go to my stie at http://nytesoft.hypermart.net

------------------
Patrick Chukwura
http://nytesoft.hypermart.net
Quote Reply
Re: Will Y2K effect CGi scripts? In reply to
Y2K could ceartainly affect CGI scripts. Please note that CGI is just an interface, and the script can be in any language (shell, perl, tcl, vb, c).

Quote:
I think I know how to fix it tell me if I am right:

Sorry, no. Smile One common Y2K problem in perl is how programmers handle dates. A common mistake is to do:

$year = (localtime())[5]; # get the year
$year = "19$year";

The value returned by perl is the number of years since 1900. In the year 2000, this number will be 100! So the correct way to get a four digit year is:

$year = $year + 1900;

This will work straight into the year 2000.

As to what sort of affects, well it can be wide ranging and really depends on where and how dates are used in your program.

Let me know if this clears things up or if you have any questions,

Cheers,

Alex
Quote Reply
Re: Will Y2K effect CGi scripts? In reply to
Oh and also, both Links 1.1+, Links 2, DBMan and FileMan are Y2K compliant and will work as expected assuming your o/s is working as it should.

Cheers,

Alex
Quote Reply
Re: Will Y2K effect CGi scripts? In reply to
Thanx Alex, that really helped. I wanted to know this because I have about 8 CGI scripts on my site that run on date, and it would be terrible if they messed up on the same day.
Smile Smile Smile :|

------------------
Patrick Chukwura
http://nytesoft.hypermart.net