CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Program suffers from Y2K bug!!!

 



abockover
Deleted

Jul 24, 2000, 10:16 AM

Post #1 of 3 (905 views)
Program suffers from Y2K bug!!! Can't Post

Help!

My search engine suffers from the Y2K bug!

When a user searches for something on my site and a list of matching files are found, each file has a date on it. this is displayed like:

June 25, 100

it needs to be displayed like:

June 25, 2000

Below is the code for the date sub:

<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>


sub formattedDate {
my($date) = @_;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($date);
@months = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
if ($year<100) {$year += 1900;}
$fdate = "$months[$mon] $mday, $year";
return $fdate;
}
</pre><HR></BLOCKQUOTE>

Please tell me what I need to do to fix this Y2K bug.

Thanks,

Aaron


TheGame+
Deleted

Jul 24, 2000, 3:00 AM

Post #2 of 3 (905 views)
Re: Program suffers from Y2K bug!!! [In reply to] Can't Post

Learn to read, maybe ? Wink Seriously, you have a line that says :
if ($year < 100) {$year += 1900;}
Replace that with :
$year += 1900;

Wink added to reflect my wonder at the fact that abockover pinpointed the right subroutine where the problem was, but failed to notice that there was only one line there that contains the number 100 and adds 1900 in some cases.


[This message has been edited by TheGame+ (edited 07-25-2000).]


Cretep
User

Jul 24, 2000, 7:17 PM

Post #3 of 3 (905 views)
Re: Program suffers from Y2K bug!!! [In reply to] Can't Post

Thats not very nice. People make mistakes, we are here to help out people not insult them!!!

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives