耙时区 [英] Rake Time Zones

查看:34
本文介绍了耙时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将新时区添加到时区列表中?

How would I add a new time zone to the list of time zones?

如果我必须简单地向我的系统添加一个时区,为什么它没有出现在列表中:

If I would have to simply add a time zone to my system, why doesn't it appear on the list:

rake time:zones:all

正如下面的 ranja 所提到的,我尝试将 ActiveSupport 与时区一起使用.

As mentioned by ranja below, I tried to use ActiveSupport with time zones.

所以我打开控制台

user@host:/var/www/project$ irb
irb(main):001:0> require 'active_support'
=> true
irb(main):002:0>

但是接下来我应该使用什么?新时区会丢失吗?我将如何实现一个永久的新 ruby​​ 时区,它可以在我的所有 aps 上使用?到目前为止,谢谢!

But what should I use next? And will the new time zone be lost? How would I implement a permanent new ruby time zone which would be available on all my aps? Thanks so far!

推荐答案

在你的rails控制台输入下面的命令,你可以获得名字列表

In your rails console type below command , you can get list of name

     ActiveSupport::TimeZone.all.map(&:name)

这篇关于耙时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆