开发者

iPhone Objective-C convert String to NSDate *special case

I know this kind of questions have开发者_如何学编程 been asked a thousand times on this forum, but I have a slightly special case which I could really use some help with.

I have an NSString *expirationDate with the value = "2010-06-23 04:28:59.341818"

I need to convert to an NSDate object and compare against the current Date/Time. Can someone kindly explain how to do this?

I'm assuming its going to use some kind of NSDateFormatter object with YYYY-MM-DD HH:MM:SS... but how do i handle the remaining decimal portion?


NSDateFormatter *formatter = [[NSDateFormatter alloc] init];        
[formatter setDateFormat:@"SSSSSS"];
NSString *dateInMyFormat = [formatter stringFromDate:[NSDate date]];



value of - dateInMyFormat: 648000
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜