菜鸟教程小白 发表于 2022-12-12 13:36:37

没有 GMT 偏移量的 IOS 时区缩写。需要直接像IST,EST等


                                            <p><pre><code> NSTimeZone *timezone = ;
NSString *timeZoneAbberivation = ;
</code></pre>

<p>timeZoneAbberivation 像 GMT+5:30 那样打印。但我需要将 GMT+5:30 打印为 IST。 (IST 属于印度/加尔各答)。</p>

<p>假设如果是美国/纽约时区,我需要它作为 EST 等。</p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>您可以使用 <code>NSDateFormatter</code>。查看提供“短特定非位置格式”的 <code>z</code> 格式参数</p>

<p> <a href="https://waracle.com/iphone-nsdateformatter-date-formatting-table/" rel="noreferrer noopener nofollow">NSDateFormatter Date Formatting Table</a> </p></p>
                                   
                                                <p style="font-size: 20px;">关于没有 GMT 偏移量的 IOS 时区缩写。需要直接像IST,EST等,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/45327894/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/45327894/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: 没有 GMT 偏移量的 IOS 时区缩写。需要直接像IST,EST等