Local Time Zone iPhone
I'm parsing an.ics file that includes time stamps of events like this:
20101008T230000Z
This is, as far as I understand, expressed in UTC. Now, I want my app to display this time correctly, depending on the time zone where the iPhone user resides. So, as an example, if the user would be in London, the time would be displayed as '23:00' while in Amsterdam it would be '22:00'
I've been looking at similar questions here at ST开发者_运维技巧ackOverflow, and it only confused me.
Any help is greatly appreciated.
Hopefully this helps. Read the time into an NSString
and use the complementary function in NSDateFormatter
(dateFromString
) after setting the time zone as shown in the link. You should then be able to get a local date/time from the NSDate
object's description
and descriptionWithLocale
functions.
精彩评论