RE: [PHP] getdate
| From: | Brian V Bonini | Date: | Fri, 12 Jul 2002 00:46:20 +0000 |
| Subject: | RE: [PHP] getdate | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-107275@lists.php.net to get a copy of this message | ||
Yes, that did the trick... Thanks!!!
> -----Original Message-----
> From: Miguel Cruz [mailto:mnc@stoic.net]
> Sent: Thursday, July 11, 2002 6:20 PM
> To: Brian V Bonini
> Cc: php-general@lists.php.net
> Subject: RE: [PHP] getdate
>
>
> 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:rasmus@php.net]
> > > Sent: Wednesday, July 10, 2002 6:24 PM
> > > To: Brian V Bonini
> > > Cc: php-general@lists.php.net
> > > 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
> > > >
> > >
> > >
> >
> >
> >
>