current time for the desired country

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

current time for the desired country

Post by pleigh »

hi, i am looking for a function the will get the time for a specific country where the the time that will reflect in the users all over the world will view the time where the hosting server will be...i hope you understand...for example, if the server is in india, and i am a user from italy, i will be able to view the indian time in my computer... :)

by the way, i also want to get the weather for that country as well... :wink:
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

You'll have to gather the data and put it into a table.

I'd recomend taking a look at The World Factbook They also have a downloadable one I belive...
someberry
Forum Contributor
Posts: 172
Joined: Mon Apr 11, 2005 5:16 am

Post by someberry »

Sounds like you may need putenv(). Didn't really understand you though.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Getting the time set on the server is really simple: time(). Whether that is accurate to where the server is located is up to its administrator, however if you want to place the server in a specific location gmmktime() is more useful to get a standardized time which can be offset however you wish from GMT. Depending on server settings, it may not take daylight savings into account. If this is the case, you'll have to build the logic for when to adjust the time further based on your regional daylight rules.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

My country (Canada) has 6 timezones - you might need to get more granular than country.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply