I have modified a Perl calendar found on PSC so that the user can add events to it. The inputs are written to a file in this fmt:
Quote:08/16/2003|Johnny's birthday!!!
But if the users Regional Settings are different, short date = mm/dd/yy then I will get a mix of 2 and 4 digit years
Quote: 12/08/2003|Don's Birthday!!!!
12/16/03|Char B-Day
03/18/2003|Brenda B-Day
03/19/03|Calib B-Day
This is where my code needs help... If the person calling the web page has a different setting they won't see the appts written in the opposite setting. How can I get around the fact that everyones PC has different short date settings???
Code:sub CheckForAppts {
my $strAppts = '';
my $Mo = 0;
my $Da = 0;
my $Ye = 0;
my @Apptsarray = ();
my $Apptdate = 0;
my $Description = '';
open and read from file
open(DAT,"Appts.cgi") || die("Cannot Open File");
@Apptsarray = <DAT>;
close(DAT);
assigned the contents to an array.
close the file.
foreach $Apptdate (@Apptsarray)
{
chomp ($Apptdate);
($Apptdate,$Description)=split (/\|/,$Apptdate);
($Mo,$Da,$Ye)=split (/\//,$Apptdate);
if ($mon == ($Mo - 1) && $day == $Da && $year == $Ye) {
$strAppts .= "\ $Description <br>\n";
}
}
return $strAppts;
}
From calendar globals: $mon, $day, $year = localtime(time);
I am not very exerienced in Perl. I took me awhile to write this sub.
Thanks for your help
Enter your message below
Sign in or Join us (it's free).