I can't seem to figure out how to change what date() comes out with from, say, 9:00 PM to 7:00 PM. It's showing me a time that's two hours ahead of what I want it to show...
Problems with the PHP date() function
| Solugon wrote: |
| I can't seem to figure out how to change what date() comes out with from, say, 9:00 PM to 7:00 PM. It's showing me a time that's two hours ahead of what I want it to show... |
use gmdate() and adjust according to your GMT offset, for example
| Code: |
| <?php
define('GMT_OFFSET', '-25200'); // for time at GMT-0700 $now = gmdate('Y-m-d H:i:s', time() + GMT_OFFSET); echo $now, '<br>'; ?> |
If you have PHP 5 >= 5.1.0RC1 you probably could use the timezone information. See date_default_timezone_set().
Thanks a lot!
Hmm. Now any idea how to make a clock that updates itself every second without requiring a page refresh? >_>
Hmm. Now any idea how to make a clock that updates itself every second without requiring a page refresh? >_>
^ Javascript and forms?
K, I'll look into that... thanks.
