kennygadams
Programmer
Hi,
I'm trying to display my server's CDT as PST but I can't get the minutes right. The minutes are not matching the actual PST time but the hours do.
Here's the code I'm using and you can see this function at work in the top-right sidebar at
Kenny
I'm trying to display my server's CDT as PST but I can't get the minutes right. The minutes are not matching the actual PST time but the hours do.
Here's the code I'm using and you can see this function at work in the top-right sidebar at
Code:
@months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
@weekDays = qw(Sun Mon Tue Wed Thu Fri Sat Sun);
($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime(time()-3*3600);
$year = 1900 + $yearOffset;
$theTime = "$hour:$minute:$second, $weekDays[$dayOfWeek] $months[$month] $dayOfMonth, $year";
if($hour >= 12){
$hour = ($hour-12);
print "$hour:$minute p.m.";
}
else{
print "$hour:$minute a.m.";
}
Kenny