I have a complex date format and I need to process it to only date and time. Example for my current date format is given below.
I am not sure what some fields are meant to be. What I want from above example is given below.
firstString = "08-12-2014"
secondString = "14:11"
I already tried many date formats but they didn't worked. So please help me. Thanks for your time.
Best How To :
// Date formatter for your date string: 2014-12-08T14:11:32.636Z
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
// Date from your string
NSDate *date = [dateFormatter dateFromString:@"2014-12-08T14:11:32.636Z"];
// T => Week Day
// S => Fractional Second
// Z => zone- Time Zone
// Updating to your format for preffered style
NSString *firstString = [dateFormatter stringFromDate:date];
NSString *secondString = [dateFormatter stringFromDate:date];
For more ref: http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns