[thelist] Date returning 20100 - second try

CDitty mail at redhotsweeps.com
Thu Jun 29 20:26:28 CDT 2000


Thank you sir.  That did the job.

CDitty

At 07:33 PM 6/29/00 , you wrote:
>CDitty wrote:
> >
> > Haven't seen this come through yet.  Please forgive if this is a dup.
> >
> > Can someone tell me why this routine is returning 20100 instead of 2000?
> >
> > @date = localtime(time);     #puts the current time/date into an array
> > $day = $date[3] + 1;         #have to add 1 since it returns days 
> starting at 0
> > $month = $date[4] + 1;       #same with the month
> > $yr = "20" . $date[5];       #only returns a 2 digit year, change 19 to 20
> > after y2k
> > print "$yr\n";
>
>Because $date[5] is sending 100 instead of 00.
>
>What I do (since this looks like perl):
>
>if ($date[5] > 99) {
>   $yr = 1900 + $date[5];
>} else {
>   $yr = "20" . $date[5];
>}
>
>--
>Anthony Baratta
>President
>KeyBoard Jockeys
>                     South Park Speaks Version 3 is here!!!
>                        http://www.baratta.com/southpark
>                               Powered by Tsunami
>
>---------------------------------------
>For unsubscribe and other options, including
>the Tip Harvester and archive of TheList go to:
>http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list