Zend - The PHP Company




Conversion

Add Code


Set to my local time  

Type: code fragment
Added by: idban
Entered: 03/03/2000
Last modified: 07/12/2001
Rating: **** (7 votes)
Views: 10817
Convert server time to local time just use if your sever have different time with your place, sample you live in indonesia like me and your server is on US.


<? 
/* 
convert server time to local time coded by idban secandri <idban@satunet.com> 
just use if your saver have different time with your place, sample you live in indonesia
like me and your server is on US.

hopely this program help much

Free for use!! you no need for pay me :) 
but if you feel helped just drop me a POST CARD! sure i want it 
mail me first for my snail address :)

have a nice coding!

jakarta indonesia
idban secandri <idban@satunet.com>
*/  

?>
<font face="arial" size="-1">
Today server time is  <? $stoday date"F d, Y  H:i"); echo $stoday ?><BR>
<br>
<?
$year 
gmdate "Y"mktime (date"H")+7,date"i"),date"s"),date"m"),date"d"),date"Y")));
$mnt gmdate "F"mktime (date"H")+7,date"i"),date"s"),date"m"),date"d"),date"Y")));
$day gmdate "d"mktime (date"H")+7,date"i"),date"s"),date"m"),date"d"),date"Y")));
$H gmdate "H"mktime (date"H")+7,date"i"),date"s"),date"m"),date"d"),date"Y")));
$minutes date "i");
?>  

Today on Indonesia (GMT+7), time is  <? print( "$mnt $day$year  $H:$minutes"); ?> 
<br>
<br>

Today on Indonesia (GMT+7), time is 

<?
/*
how to get number 12?
use this on you local server
<? $getZtime = date("Z"); $Ztime=$getZtime/60/60; echo $Ztime ?>
now upload that code to your real server, you will got new Ztime
if the result == - , that mean the server -x from GMT so add  your local time to server time
i.e; the result on server = -5 so you need add 7 + 5 = 12
if the result !== - , that mean the server +x GMT so just calculate your local time with your server time
i.e; the result on server = 1 so just calculate 7 - 1 = 6
- = local time + server time
+ = local time - server time
*/ 

$indo_today date"F d Y  H:i",time()+12*3600); 
echo 
$indo_today;
?>


Usage Example


See the example


Rate This Script





Search



This Category All Categories