webmaster help me
how to adjust clock at lavair sc
Collapse
X
-
You can use function to make your own time function
PHP Code:function your_time(){
$to_adjust = (3 * 60 * 60); // $to_adjust = (HOURs * MINs * SECs);
$your_time = time() + $to_adjust;
return $your_time;
}
Change the default of your timezone
PHP Code:date_default_timezone_set(Asia/Hong_Kong);
-
ok, well you could go about this differently too...
if you add a field in the users table for timezone, then you can use the
date_default_timezone_set(Asia/Hong_Kong);
command to change time to users timezone so that it shows their time...
you would need to add a timezone list to the register form so they can select the closest timezone to their own...
something similar to this function, just link it to the database...
so
code is:
/////////////////////////////////////////////////////
/////////////function//////////////////////////////
function clockbar($timezone)
{
date_default_timezone_set("$timezone");
$timenow = time();
$newdate = date('D jS M y',$timenow);
$timenow = date("h:i:s A", $timenow);
echo "<div style=\"border:2px grey inset; background:grey\" align=\"center\">";
echo "Time In: $timezone:<br/>";
echo "<small><b>";
echo "Time: $timenow<br/>Date:$newdate";
echo "</b></small>";
echo "</div>";
}
////////////////////////////////////////////////////////////////////
$timezone = mysql_fetch_array(mysql_query("SELECTtimezone FROM ibwf_users WHERE id='".$uid."'"));
echo "".clockbar($timezone[0])."";
////////////////////////////////////////////////////////////////////
Comment
-
ok dude, read this:
date manual
that should help you out...
and generally if you use the date set timezone command you put that in config.php so that the timezone is set all the time...
date_default_timezone_set manual
that will give you more than i know about the command, lol... where you think i learned what i know? gooogle man...
Comment
Comment