Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php Time ?

Status
Not open for further replies.

Extreme43

Programmer
Dec 21, 2004
23
AU
hey
before i start im running iis on my windows 2003 server

i use this method to display time
except it is 30 minutes slow of the time which is GMT +10
how would i fix this?
$time = date ("h:ma");
 
I know this may seem like a silly question but is the system clock correct on your server?


If it aint broke, redesign it!
 
you have to use PUTENV("TZ=...
I have made a sql database, containing ISO for timezones.

Lookie:
I released it as opensource.

It's based on two tables..
ISO3166 (country names) + timezone table, called tbl_timezone.

You let your users select a country from a list you generated from iso3166 table. Then you use the <option value=<2 char iso3166 code>"..

When the user then browses the page, run a query and check if the user has he field TZ set, in the db. if it's not set, run a natural join between user_table, iso3166 table and the timezone table.

If mysql_num_rows > 1, this means the country has more than one timezone. Then you generate a list of the availible timezones and let the user choose.

That then updates the field TZ in the user table.
The next time the page refreshes, you get the TZ value (for example: 'Asia/Bishkek') and use the putenv("TZ='Asia/Bishkek');

there is no TZ in the mysql db, so you will ned to use addtime function, with the difference from old_TZ - new_TZ

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top