23
24

More than 5 years have passed since last update.

Rails4 - タイムゾーンとロケールを日本(語)に設定

Last updated at Posted at 2014-04-15

application.rbに設定追加

表示時のタイムゾーンをJSTに変更
DB保存時のタイムゾーンをJSTに変更
ロケールを日本語に変更

application.rb
    # 表示時のタイムゾーンをJSTに変更
    config.time_zone = 'Tokyo'
    # DB保存時のタイムゾーンをJSTに変更
    config.active_record.default_timezone = :local

    # ロケールを日本語に変更
    config.i18n.default_locale = :ja
23
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
24