My Web-service returns me date which is like this/Date(1342622718553-0700)/
.
How can i convert it to NSDate.
I have seen this type of parsing Here and Here but its not for iOS.
My Web-service returns me date which is like this/Date(1342622718553-0700)/
.
How can i convert it to NSDate.
I have seen this type of parsing Here and Here but its not for iOS.
The date formate you are parsing is known as ISO8601 DateFormatter, its older date formate and its recommonded not to use in new development. for Your solution you can parse this date by using library class ISO8601DateFormatter Classes
first import ISO8601DateFormatter.h and .m files in ur project and parse your date as follows:
NSString *myDate = @"/Date(1342622718553-0700)/";
ISO8601DateFormatter *dateFormatter = [[ISO8601DateFormatter alloc] init];
[dateFormatter setFormat:ISO8601DateFormatOrdinal];
NSDate *dateObject = [dateFormatter dateFromString:myDate];
This works for me. You can edit format style according to your requirement. This link gives you detail Check Here for ISO 8601 date formatter