1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Ruby on Rails | I18nで24時間表記を午前午後表記にする ( 日本語対応 )

Last updated at Posted at 2017-09-05

ちょっと苦しいがこんな感じ。

I18n.l Time.zone.now.change(hour: 8), format: '%p%l時'
# => "午前 8時"
I18n.l Time.zone.now.change(hour: 22), format: '%p%l時'
# => "午後10時"

環境

  • i18n (0.8.6)
  • rails-i18n (5.0.4)

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?