阅读背景:

尝试从MySQL日期时间字符串格式化NSDate时获得(null)结果

来源:互联网 

I have the following code:

我有以下代码:

- (NSString *)
  lastSeenDateString:(NSString *)dateString
{
  NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
  [dateFormatter setTimeZone:[NSTimeZone defaultTimeZone]];
  [dateFormatter setDateFormat:@"yyyy-MM-ddTHH:mm:ssZ"];
  NSDate *date = [dateFormatter dateFromString:dateString];

  NSString *result = [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle];

  return result;
}
- (NSStr



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: