Reputation: 1625
I have such response from server Date = "/Date(1348783200000+0200)/"
how can I parse it to timestamp or date (example: Monday 21, September, 2012)?? please help..
Upvotes: 1
Views: 138
Reputation: 14154
It looks like your date is in milliseconds. You will need to divide by 1000 and cast it into an NSDate
after that. Then you can just use NSDateFormatter
with NSDateFormatterLongStyle
to show the date in that format.
NSTimeInterval dateInterval = dateWithMilliseconds;
dateInterval = dateInterval / 1000;
NSDate *date = [NSDate dateWithTimeIntervalSince1970:dateInterval];
NSDateFormatter *formatter = [NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterLongStyle];
NSString *dateString = [formatter stringFromDate:date];
Upvotes: 2