Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
199 views
in Technique[技术] by (71.8m points)

mysql - How to convert time to the time zone of the iPhone device?

I have a time in EST timezone, it is done using the NOW() function on the mysql server. Because my server is located in EST, the time stored is in EST. When I retrieve it from my app on the iPhone, I need to display it in the correct time zone of the user. How do I do that?

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I think it depends on what you mean by EST - if you mean East Coast US, then in general, that is 5 hours behind UTC (but not accounting for daylight saving), which should give you 04:00 EST. Try to avoid using abbreviations where possible, as they are ambiguous, e.g. EST is the abbreviation for both America/Detroit and Australia/Sydney. Using NSTimeZone initWithName will give more precise results.

The Chronos Time Zone Repository provides a nicely readable XML timezone database that really helps in understanding how time zones work (it's all rather messy and changeable).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...