user1511244
user1511244

Reputation: 725

Changing time format and zone on iOS?

I have an application that currently parses data from a server. Inside the data there are various dates for various events. The thing is that the application will be international so i would like when the date is downloaded to the phone from the server through an xml file to be in the correct zone.

All the dates i have are in GMT+2. The format of my dates is(example) : 21:45 31-08-2012 GMT+2

Is it possible somehow if the users phone is in an different time zone , for example GMT+4 , to change the time automatically so that the user could see the correct time? How would that look programaticaly?

Upvotes: 0

Views: 108

Answers (1)

Resh32
Resh32

Reputation: 6590

A common practice is to use UNIX EPOCH (with no timezone information) to convey information from/to your clients. The conversion can then be done when displaying a date in a particular locale using:

[NSDate dateWithTimeIntervalSince1970:ephochValue];

Upvotes: 2

Related Questions