Re: date() on two diff. servers
| From: | @ Edwin | Date: | Mon, 09 Dec 2002 14:20:52 +0000 |
| Subject: | Re: date() on two diff. servers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-127496@lists.php.net to get a copy of this message | ||
Hello gurus,
"Ford, Mike [LSS]" <M.Ford@lmu.ac.uk> wrote:
[snip]
> To amplify on this:
> ...
[/snip]
Interesting comments! ...not sure if I understood everything though :(
Anyway, for Justin's original problem, I think it'll be solve by "simply"
doing two things:
1. Add " GMT" to the end of the string being passed to strtotime().
2. Use gmdate() instead of date().
Ex.
<?php
$my_date = "December 10, 2002 22:13:09";
$my_date .= " GMT";
// testing on my test server...
// with the string " GMT", echo $my_stamp -> 1039558389
// without it, echo $my_stamp ------------------> 1039525989
$my_stamp = strtotime($my_date);
echo "$my_stamp<br />";
echo gmdate('D, d M Y G:i:s', $my_stamp);
// Conclusion: Using strtotime() with GMT will create
// a timestamp that if used with gmdate() will produce
// desired result whichever timezone you run the script.
?>
That should work. If not, tell me about it later--I'm more than happy to be
corrected. But for now, I'll be taking some rest :)
- E