Vote count:
0
I get timestamps from some RESTful services with this format:
"/Date(1357306469510+0100)/"
I found some posts providing code to parse this and create its equivalent NSDate object, for example:
NSInteger offset = [[NSTimeZone defaultTimeZone] secondsFromGMT];
NSInteger startPosition = [jsonDate rangeOfString:@"("].location + 1;
NSTimeInterval unixTime = [[jsonDate substringWithRange:NSMakeRange(startPosition, 13)] doubleValue] / 1000;
NSDate *date = [[NSDate dateWithTimeIntervalSince1970:unixTime] dateByAddingTimeInterval:offset];
but it does not seem to deal with the timezone of the server's timestamp (+0100).
Could somebody provide a complete solution, or tell me where could I find it?
Thanks in advance
asked 1 min ago
Appropriately parsing timestamp in JSON format in iOS
Aucun commentaire:
Enregistrer un commentaire