"Justin French" <[EMAIL PROTECTED]> wrote:

> on 09/12/02 3:06 PM, @ Edwin ([EMAIL PROTECTED]) wrote:
>
> > [snip]
> >> Perhaps strtotime() is NOT running off GMT,
> > [/snip]
> >
> > Bingo!
>
> *GULP*... so, what we're saying is, that if I intend to pass data around
on
> multiple servers (in different timezones) using a unix timestamp for dates
> (which i prefer to do), I should be using gmdate() and gmmktime() rather
> than date() and strtotime()?

I'm afraid so...

> That will sure as hell be a few lines of code to dig through!!!!

Well... just hope that others chime in and suggest a better solution :)

> I'll also need an accurate (and daylight savings compliant!) way of
> determining the how far ahead of the GMT the server currently is, or for a
> specific timezone for a specific project (eg this current one, which is
> basing it's dates on Sydney, Australia.

If I understand the problem correctly and if my understanding of the
functions are correct, I'm not sure if you'd really need something like
this. Consider this:

<?php

  $timestamp_local = time();
  $timestamp_gmt = gmmktime();
  $run_local = date("F j, Y, G:i:s", $timestamp_local);
  $run_gmt = gmdate("F j, Y, G:i:s", $timestamp_gmt);

  echo "Local Timestamp: $timestamp_local<br />";
  echo "GMT Timestamp: $timestamp_gmt<br /><br />";

  echo "This script was run on: <br />";
  echo "$run_local  (DATE with Local Timestamp)<br />";
  echo "$run_gmt  (GMDATE with GMT Timestamp)<br />";

?>

As you can see, although the timestamps are different, they produce the same
results. So, *I think*, using gmdate() and gmmktime() would be enough. (Or,
if you insist on using strtotime(), consider the example(s) in the "User
Contributed Notes" I mentioned earlier.)

I hope this give you some hints.

- E


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

Reply via email to