The 'date' command-line utility reads the time zone from environment
variable 'TZ'. It then adjusts the system time before displaying it.

So your server is probably set to GMT, and your login environment
specifies EDT, which is 4 hours earlier. PHP is defaulting to GMT. Look
into putenv().

miguel

On Wed, 10 Jul 2002, Brian V Bonini wrote:
> Hmmm, wierd!! The server is physically in PDT I am in EDT but I have the
> servers time zone set to EDT and as I said "date" verifies the correct time
> but yet the script returns a time that is 4 hours ahead. Wierd.... :(
> 
> > -----Original Message-----
> > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 10, 2002 6:24 PM
> > To: Brian V Bonini
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] getdate
> >
> >
> > Works fine here.  Are you actually in EDT?
> >
> > On Wed, 10 Jul 2002, Brian V Bonini wrote:
> >
> > > 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";
> > >     ?>
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> 
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to