0

I have tried doing this

NSString*
    dateAsString = @"/Date(1353720343336+0000)/";
    dateAsString = [dateAsString stringByReplacingOccurrencesOfString:@"/Date("
                                                           withString:@""];
    dateAsString = [dateAsString stringByReplacingOccurrencesOfString:@"+0000)/"
                                                           withString:@""];

unsigned long long milliseconds = [dateAsString longLongValue];
NSTimeInterval interval = milliseconds/1000;
NSDate* date = [NSDate dateWithTimeIntervalSince1970:interval];

But its not working.

user3783213
  • 5
  • 1
  • 7

1 Answers1

0

You should use a NSDateFormatter to parse from string to date, since the string date comes in a very particular format you must give a date formar, specified using ISO characters codification. Check this tutorial and documentation .
Formatting it correctly you get an NSDate object and creating another date formatter you can specify a more readable format.

Andrea
  • 26,120
  • 10
  • 85
  • 131