iphone - NSDateFormatter dateFromString will not parse a particular date string -
Good day,
I have an NSDateFormatter that does not like any particular string to convert I'm trying this special example
2009-10-16T09: 42: 24.999605
All my other dates are formatted and parsed can be done. / P>
Here is the code that converts strings into NSDate.
NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init]; [DateFormatter setDateFormat: @ "yyyy-MM-dd'THH: mm: ssssssss"]; [Set setModifiedAtDate: [dateFormatter dateFromString: [orderDataDictionary Price ForKey: @ "ModifiedAt"]]];
order.ModifiedAtDate is zero since the date FromString call.
In any other case where their dates can not be converted into NSDates?
Thank you,
I remove the subsecond field from the formatter and get the date of the parse Was able to:
NSString * test = @ "2009-10-16T0 9: 42: 24.999605"; NSDateFormatter * dateFormatter = [[NSDateFormatter alloc] init]; [DateFormatter setDateFormat: @ "yyyy-MM-dd'H'HH: mm: SS"]; NSDate * testOut = [dateFormatter dateFromString: test];
I suspect that you can find out more detail why using this function is unsuccessful in the subsecond field as it seems that it works the same way, but the error Message:
:
At any rate, hopefully you are going again.
Comments
Post a Comment