I have searched throughout. I need to parse a date string as: NSString * dateString = @"2014-01-14T10:10:44.497Z"
I need the day as mon, tue, wed etc.
I can't get any formatter to convert the date am getting.
any help ?
Thanks in Advance
code that i have been using :
NSString * time = @"2014-01-14T10:10:44.497Z";
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZ"];
NSDate *date1 =[self dateFromISO8601String:time]; //[df dateFromString:time];
NSLog(@"date : %@", date1);
long lgTime = (long)[date1 timeIntervalSince1970];
NSLog(@"%ld", lgTime);
NSCalendar* calender = [NSCalendar currentCalendar];
NSDateComponents* component = [calender components:NSWeekdayCalendarUnit fromDate:date1];
NSLog(@"date=%@ === %@",[NSDate date],date1);
NSLog(@"day= %d",[component weekday]); ///it retu
response in console: *error*
2014-01-14 17:42:23.790 TextDate[2847:a0b] date send : 2014-01-14T10:10:44.497Z
2014-01-14 17:42:23.790 TextDate[2847:a0b] date : (null)
2014-01-14 17:42:23.791 TextDate[2847:a0b] 0
2014-01-14 17:42:23.794 TextDate[2847:a0b] * -[__NSCFCalendar components:fromDate:]: date cannot be nil
I mean really, what do you think that operation is supposed to mean with a nil date?