PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Let's say the server hosting the web site is in Texas and the people looking at the web site and retrieving the data are in Australia. They want to know when the form was submitted at the right time.
Has anybody got a straight forward, one size fits all, method to insert an adjusted the time at the Australian timezone, using PHP4?
gmdate
ttech5593 at gmail dot com
29-Mar-2006 09:53
For me most of the examples here needed the + or - seconds to set the time zone. I wanted a faster way to get the time zone in seconds. So I created this :
<?php
$h = "3";// Hour for time zone goes here e.g. +7 or -4, just remove the + or -
$hm = $h * 60;
$ms = $hm * 60;
$gmdate = gmdate("m/d/Y g:i:s A", time()-($ms)); // the "-" can be switched to a plus if that's what your time zone is.
echo "Your current time now is : $gmdate . ";
?>