Re: [PHP] unexpected date results

2003-08-21 Thread Curt Zirzow
* Thus wrote Cody Phanekham ([EMAIL PROTECTED]):
 ?
 $t = time();
 echo \nbrtimestamp = $t;
 echo \nbrtime =  . 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:
 brtimestamp = 1061443722
 brtime = Thu, 21 Aug 2003 05:28:42 +

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

You'll have to consult your system documentation to set it system
wide and to get the proper name of the TZ.

That should help ya.

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] unexpected date results

2003-08-21 Thread Cody Phanekham
Curt,

The admin that is in charge of the server swears that the time zone is already set to 
Australia / Sydney

 -Original Message-
 From: Curt Zirzow [mailto:[EMAIL PROTECTED]
 Sent: Thursday, 21 August 2003 17:11
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] unexpected date results
 
 
 * Thus wrote Cody Phanekham ([EMAIL PROTECTED]):
  ?
  $t = time();
  echo \nbrtimestamp = $t;
  echo \nbrtime =  . 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:
  brtimestamp = 1061443722
  brtime = Thu, 21 Aug 2003 05:28:42 +
 
 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
 
 You'll have to consult your system documentation to set it system
 wide and to get the proper name of the TZ.
 
 That should help ya.
 
 Curt
 -- 
 I used to think I was indecisive, but now I'm not so sure.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


*
This e-mail, including any attachments to it, may contain confidential and/or personal 
information.
If you have received this e-mail in error, you must not copy, distribute, or disclose 
it, use or take any action 
based on the information contained within it.

Please notify the sender immediately by return e-mail of the error and then delete the 
original e-mail.

The information contained within this e-mail may be solely the opinion of the sender 
and may not necessarily 
reflect the position, beliefs or opinions of Salmat on any issue.

This email has been swept for the presence of computer viruses known to Salmat's 
anti-virus systems.

For more information, visit our website at  www.salmat.com.au.
*


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



Re: [PHP] unexpected date results

2003-08-21 Thread Curt Zirzow
* Thus wrote Cody Phanekham ([EMAIL PROTECTED]):
 Curt,
 
 The admin that is in charge of the server swears that the time zone is already set 
 to Australia / Sydney

It is definately a system problem. I actually looked at the source
code for the date() function and all it does is get the time
information from the systems localtime call.

A 'man localtime' might reveal more information about how the
timezone needs to be set.

Although the environment setting for the cron fle should work fine,
you could even go so far as setting that in your php file:

  putenv('TZ=Australia/Sydney');


hth,

Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



RE: [PHP] unexpected date results

2003-08-21 Thread Ford, Mike [LSS]
On 21 August 2003 08:11, Cody Phanekham wrote:

  -Original Message-
  From: Curt Zirzow [mailto:[EMAIL PROTECTED]
  Sent: Thursday, 21 August 2003 17:11
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] unexpected date results
  
  
  * Thus wrote Cody Phanekham ([EMAIL PROTECTED]):
   ?
   $t = time();
   echo \nbrtimestamp = $t;
   echo \nbrtime =  . 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:
   brtimestamp = 1061443722
   brtime = Thu, 21 Aug 2003 05:28:42 +
  
  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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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



RE: [PHP] unexpected date results

2003-08-21 Thread Cody Phanekham
Curt/Mike,

 -Original Message-
 From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]
 
 date '+%c'# might be different -- check your man date

the date returned was correct...

 -Original Message-
 From: Curt Zirzow [mailto:[EMAIL PROTECTED]
 
   putenv('TZ=Australia/Sydney');
 
This works beautifully! plus i dont have to rely on the damn sys admin :)


*
This e-mail, including any attachments to it, may contain confidential and/or personal 
information.
If you have received this e-mail in error, you must not copy, distribute, or disclose 
it, use or take any action 
based on the information contained within it.

Please notify the sender immediately by return e-mail of the error and then delete the 
original e-mail.

The information contained within this e-mail may be solely the opinion of the sender 
and may not necessarily 
reflect the position, beliefs or opinions of Salmat on any issue.

This email has been swept for the presence of computer viruses known to Salmat's 
anti-virus systems.

For more information, visit our website at  www.salmat.com.au.
*


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



RE: [PHP] unexpected date results

2003-08-20 Thread Martin Towell
The reason for the difference is due to the timezone bit (or whatever it's
called..)

Note the +1000 in this line
time = Thu, 21 Aug 2003 15:28:36 +1000 
and the + in this line
time = Thu, 21 Aug 2003 05:28:42 +
so both are actually the same times (bar a few seconds..)

But for the reason why one is showing GMT and the other Oz time, I don't
know...

HTH though
Martin


-Original Message-
From: Cody Phanekham [mailto:[EMAIL PROTECTED]
Sent: Thursday, 21 August 2003 3:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] unexpected date results


Ive got a pretty simple script that runs at 5 past midnight. It grabs the
local date/time and processes data based on the date/time. The problem is
the date/time returned by the date() function is incorrect.

here is a sample script (not actual script running on server):
test.php
?
$t = time();
echo \nbrtimestamp = $t;
echo \nbrtime =  . 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:
brtimestamp = 1061443722
brtime = Thu, 21 Aug 2003 05:28:42 +

has this happened to anyone before? what could cause the huge difference in
time?

Im running PHP Version 4.3.2 on NetBSD 1.6

--
Regards

Cody Phanekham

Email: [EMAIL PROTECTED]
Ext: 2183
Phone: 02 9353 2183





*
This e-mail, including any attachments to it, may contain confidential
and/or personal information.
If you have received this e-mail in error, you must not copy, distribute, or
disclose it, use or take any action 
based on the information contained within it.

Please notify the sender immediately by return e-mail of the error and then
delete the original e-mail.

The information contained within this e-mail may be solely the opinion of
the sender and may not necessarily 
reflect the position, beliefs or opinions of Salmat on any issue.

This email has been swept for the presence of computer viruses known to
Salmat's anti-virus systems.

For more information, visit our website at  www.salmat.com.au.

*


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
__ Information from NOD32 1.490 (20030820) __

This message was checked by NOD32 for Exchange e-mail monitor.
http://www.nod32.com




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