This can be helpful :
Timezones By David Mytton on http://www.olate.com/
If you wanted to find out the data and time in Finland while your servers are in Texas, then you can write your own functions using three functions already available - mktime(), gmdate() and getdate(). We need to find out what the current GMT is, this is the standard to which all timezones are compared. To do this, you use the gmdate() function which takes exactly the same arguments as date(). You then increment the hour by the GMT offset, which is passed to the function. The mktime() function automatically compensates for any change in hour that also affects a change in ay/month/year. The getdate() function is then used (which can optionally be passed a UNIX timestamp created by the mktime function). This function will then return an array with the following within it:
seconds minutes mday (day of the month) wday (day of the week, numeric) year yday (day of the year, numeric) weekday (text) month (textual) The following code will do this:
<?php
function worldtime($offset) { $day = gmdate("d"); $day = gmdate("m"); $day = gmdate("g"); $day = gmdate("y"); $day = gmdate("i"); $day = gmdate("s"); $day = gmdate("H") + $offset;
$tm_ar = getdate (mktime ( $hour, $minutes, $seconds, $month, $day, $year));
return ($tm_ar); }
$currdate = worldtime($offset); ?>
You then call this function passing it the GMT offset value, for our example
(Finland), it is 2:
<?php $finland_date = worldtime(2); ?>
And that is it!
|
|
|