这是我的NSString。
myDate : 2011-06-07 11:23:47 0000
以下是代码:
NSTimeZone *currentDateTimeZone = [NSTimeZone defaultTimeZone];
NSDateFormatter *currentDateFormat = [[NSDateFormatter alloc]init];
[currentDateFormat setTimeZone:currentDateTimeZone];
[currentDateFormat setDateFormat:@"yyyy-MM-dd HH:mm:ss Z"];
NSDate *tempDate = [currentDateFormat dateFromString:second];
仍然 tempDate 的值是 nil
。
有人可以帮忙吗?
dateFromString:
方法接收到一个不符合日期格式的字符串时,它返回什么? - Deepak DanduproludateFromString:
返回nil。 - David Gelhar