月圆之夜,紫禁之巅,一剑西来,天外飞仙。

0%

iOS htc时间转换

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
+(NSString *)htcTimeToLocationStr:(NSString*)strM
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSSZ"];

dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];

NSDate *dateFormatted = [dateFormatter dateFromString:strM];

[dateFormatter setDateFormat:@"yyyy.MM.dd HH:mm"];

NSString *locationTimeString=[dateFormatter stringFromDate:dateFormatted];

return locationTimeString;
}