开发者

How to find the date format of a string

Is there a way (an elegant way that is) to extract a date format from a string containing a date so that it may be converted into an NSDate via NSDateFormatter?

i.e

string = @"2011-1-10";
format = [extractor extractFormat:str开发者_C百科ing];// format would = yyyy-dd-mm
[formatter setDateFormatter:format];
NSDate * date = [formatter dateFromString:string];


If that is the only information you have then it is impossible. For example, "10-10-10".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜