我目前得到的时间为UTC,我希望它是转化为本地时区 NSDate * startDate;
如何UTC日期字符串转换为本地时间
例strDate - 14/9/2017上午07时28
要求格式 - 14/9/2017 1.52 pm
我需要帮助与目标c。
NSDate * startDate; //包含UTC日期
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEE, MMM d, yyyy - h:mm a"];
[dateFormatter setTimeZone:[NSTimeZone localTimeZone]];
NSString *timestamp = [dateFormatter stringFromDate:startDate];
,但这是不正确的时间,但日期是正确的
添加你的代码片段,以显示你迄今为止做了什么? – cole
'NSDateFormatter'是你正在寻找的工具。 – Larme
你有什么尝试?你写的代码在哪里?请读一读[Ask] –