how to adjust clock at lavair sc

Started on the old forum in November 2010 · view the original in the archive · old links redirect here

3 replies · 506 views · started 16 years ago · 1 min read

3 participants
awan Junior · 28 posts #1

webmaster help me

I'm not good but wanted to be clever 🙂

kei_ki7 Senior · 431 posts #2

You can use function to make your own time function

function your_time(){
$to_adjust = (3 * 60 * 60); // $to_adjust = (HOURs * MINs * SECs);
$your_time = time() + $to_adjust;
return $your_time;
}

OR

Change the default of your timezone

date_default_timezone_set(Asia/Hong_Kong);

For timezone list, go here PHP: List of Supported Timezones - Manual

Did I help you? You can help me too Your donations will help me finance my studies.

pmbguy Senior · 344 posts #3

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 ""; echo "Time In: $timezone: "; echo ""; echo "Time: $timenow Date:$newdate"; echo ""; echo ""; } //////////////////////////////////////////////////////////////////// $timezone = mysql_fetch_array(mysql_query("SELECTtimezone FROM ibwf_users WHERE id='".$uid."'"));

echo "".clockbar($timezone[0]).""; ////////////////////////////////////////////////////////////////////

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close