I have $_POST['day'] (1-31), $_POST['month'] (1-12), $_POST['year']
(2003-2004).

I store all dates as unix (epoch) timestamps, and generate the timestamp for
the event with:

strtotime('{$_POST['month']}/{$_POST['day']}/{$_POST['day']}');

Everything works fine on my LAN (Australia), but when I upload my database
to the live server (US), the dates are a day behind (when echo'd with
date('Y-m-d')), presumably due to the time difference between the two
servers.

Timestamps generated directly on the live server appear correct when echoed
out using date.


How can I reliably generate timestamps which will work on any server, and
reliably convert these timestamps to human readable format (eg
date('Y-m-d')) on any server?


Is the key to use GMT in the strtotime() string and use gmdate() instead of
date()?  Or is it more complex than that?


Thanks,

Justin French


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

Reply via email to