Reputation: 3783
In .plist file there's a field:
I do read it in a simple dictionary. Everything's okay, but on the client side, he says the time difference is -3 hours (i.e. he sees Dec 31, 2013, 10:30 PM)
I think, I should archive the project with his region settings, right?
UPD
NSDateFormatter
:self.customFormatter = [NSDateFormatter new];
[self.customFormatter setDateFormat:@"hh:mm a"];
then I convert to string using [self.customFormatter stringFromDate:date]
And I think - I should look in .plist file and change the
<date>2014-01-01T01:30:00Z</date>
into
<date>2014-01-01T01:30:00-3</date> // I see Dec 2013, 10:30 PM; client sees Jan 2014, 1:30 AM
right?
Upvotes: 0
Views: 319
Reputation: 539815
The date is stored in the property list as GMT time. Your timezone is "GMT+2", therefore "January 1, 2014 1:30:00 AM" is archived as
<plist version="1.0">
<dict>
<key>time</key>
<date>2014-01-01T23:30:00Z</date>
</dict>
</plist>
So there is no problem with the plist archive, it is independent of any timezone/locale settings ("Z" = "Zulu time" = GMT).
It is only the property list editor in Xcode, which displays the date according to your timezone and locale.
When you read the value into an NSDate
object, it represents exactly this point of
time. To present the value to the user, you have to use a NSDateFormatter
, which
converts the NSDate
to an NSString
representing this date/time according
to the user's time zone.
Upvotes: 3