I'm required to parse strings in a format that includes milliseconds. What format string do I use to get the right date value?
For example, suppose I have a string with the following value: "2011-06-23T13:13:00.000"
What format string do I pass to my NSDateFormatter in the following code?
NSString *dateValue = @"2011-06-23T13:13:00.000";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
NSString *formatString = @"yyyy-MM-dd'T'HH:mm:ss.???";
[formatter setDateFormat:formatString];
NSDate *date = [formatter dateFromString:dateValue];
What do I use in place of ??? in the code above?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…