getdate
| From: | Brian V Bonini | Date: | Wed, 10 Jul 2002 22:24:55 +0000 |
| Subject: | getdate | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-106967@lists.php.net to get a copy of this message | ||
Any idea why this is off by 4 hours?
Server time zone is set correctly,
%date
Wed Jul 10 14:26:18 EDT 2002
but the script below returns the time as being 4 hours later then that.
<?
$date = getdate();
$minutes = $date['minutes'];
$hours = $date['hours'];
$tz="EDT";
$today = getdate();
$month = $today['month'];
$mday = $today['mday'];
$year = $today['year'];
$ampm="AM";
if ($hours > 12) {
$hours=$hours-12;
$ampm="PM";
} elseif ($hours == 12) {
$ampm="PM";
}
if ( $minutes < 10) {
$minutes="0$minutes";
}
print "$hours:$minutes $ampm $tz $month $mday, $year";
?>