RE: [PHP] unexpected date results
| From: | Ford, Mike [LSS] | Date: | Thu, 21 Aug 2003 10:15:45 +0000 |
| Subject: | RE: [PHP] unexpected date results | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-160291@lists.php.net to get a copy of this message | ||
On 21 August 2003 08:11, Cody Phanekham wrote:
> > -----Original Message-----
> > From: Curt Zirzow [mailto:curt@zirzow.dyndns.org]
> > Sent: Thursday, 21 August 2003 17:11
> > To: php-general@lists.php.net
> > Subject: Re: [PHP] unexpected date results
> >
> >
> > * Thus wrote Cody Phanekham (Cody.Phanekham@salmat.com.au):
> > > <?
> > > $t = time();
> > > echo "\n<br>timestamp = $t";
> > > echo "\n<br>time = " . date("r", $t);
> > > >
> > >
> > > if i run test.php via the web it produces the following output,
> > > which is correct: timestamp = 1061443716 time = Thu, 21 Aug 2003
> > > 15:28:36 +1000
> > >
> > > if i run test.php via the command line it produces the
> > following output, which is off by 10 hours:
> > > <br>timestamp = 1061443722
> > > <br>time = Thu, 21 Aug 2003 05:28:42 +0000
> >
> > You need to set the timezone either system wide or within the
> > crontab, since crontab usually runs with a /bin/sh shell something
> > like:
> >
> > TZ=Australia/Melborne
> > export TZ
>
> Curt,
>
> The admin that is in charge of the server swears that the
> time zone is already set to Australia / Sydney
Try using date from the command line and see what it produces. If you do
something like:
date '+%c' # might be different -- check your man date
and it produces the wrong time, then you would be armed with sufficent
evidence to go to the system's admin and say "oh no it **** well isn't --
look!"
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211