ios - 将 UTC 日期转换为 NSString
<p><p>我正在尝试将带有 UTC 的 NSDate 转换为 NSString。但是它返回错误的值。如何直接将日期转换为字符串。</p>
<p>下面你可以更好地看到问题:</p>
<pre><code>NSDateFormatter *dateFormatter2 = [ init];
dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
NSString *strDate = ;
</code></pre>
<p> <a href="/image/yOQAd.png" rel="noreferrer noopener nofollow"><img src="/image/yOQAd.png" alt="enter image description here"/></a> </p>
<p> <a href="/image/BH42C.png" rel="noreferrer noopener nofollow"><img src="/image/BH42C.png" alt="enter image description here"/></a> </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><pre><code>NSDateFormatter *formatter = [ init];
;
//Optionally for time zone conversions
];
NSString *stringFromDate = ;
</code></pre></p>
<p style="font-size: 20px;">关于ios - 将 UTC 日期转换为 NSString,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/32839950/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/32839950/
</a>
</p>
页:
[1]