简体   繁体   English

我如何在轨道上的红宝石中使用UTC +14:00

[英]how do I use UTC +14:00 in ruby on rails

I want to use utc+14:00 in my rails app , but 我想在我的rails应用程序中使用utc + 14:00 ,但是

rake time:zones:all

shows up to utc+13:00 only . 仅显示utc + 13:00。 is there any workaround to use this timezone ? 有使用此时区的解决方法吗?

Rails time zones are a facade around the tzinfo gem , which uses IANA/Olson time zones. Rails时区是tzinfo gem周围的外观,它使用IANA / Olson时区。

You probably want either the zone "Pacific/Kiritimati" , which is in UTC+14 all year, or perhaps "Pacific/Apia" , which is in UTC+13 most of the year and in UTC+14 for daylight saving time. 您可能想要的是全年处于UTC + 14的"Pacific/Kiritimati"区域,或者一年中大部分时间位于UTC + 13的"Pacific/Apia" ,以及夏令时的UTC + 14区域。

Read the bottom of the timezone tag wiki about Rails time zones, then take a look at the mapping constant . 阅读有关Rails时区的timezone标签wiki的底部,然后查看映射常量 You'll see that "Pacific/Apia" is mapped to the Rails name of "Samoa" , but "Pacific/Kiritimati" is not in the map. 您会看到"Pacific/Apia"已映射到Rails名称"Samoa" ,但"Pacific/Kiritimati"未在地图中。

The best advice I can offer is to use the TzInfo gem directly, and not use Rails time zone "friendly" names. 我能提供的最佳建议是直接使用TzInfo gem, 而不使用Rails时区的“友好”名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM