0

如何使用 Rails 应用程序在 Heroku 中获取 IST 时间

config.active_record.default_timezone = :local

在 config/environments/development.rb 中。上面的代码将时区从 UTC 更改为 IST。

在 config/environments/production.rb 里面

config.active_record.default_timezone = :local

它在heroku中不起作用,为什么?我怎样才能得到 IST 时间。

4

1 回答 1

0

:local 给出服务器当前所在位置的本地时间。因此,在开发中它给了 IST 时间,但在 Heroku 上它给了 UTC,因为服务器不在印度。

您可以config.time_zone = 'New Delhi'在 application.rb 中使用来获取 IST 中的时间。

于 2018-04-21T08:36:43.513 回答