Closed junohm410 closed 2 months ago
タイムゾーンをJSTに設定できたのclose。
irb(main):001> item = Item.find(6)
Item Load (0.8ms) SELECT "items".* FROM "items" WHERE "items"."id" = $1 LIMIT $2 [["id", 6], ["LIMIT", 1]]
=>
#<Item:0x000000012b3de8a8
...
irb(main):002> item.created_at
=> Thu, 04 Jul 2024 23:53:23.560299000 JST +09:00
irb(main):003> item.updated_at
=> Sat, 06 Jul 2024 21:50:50.424930000 JST +09:00
irb(main):004> item.deadline
=> Thu, 11 Jul 2024 12:56:00.000000000 JST +09:00
Railsにおける日時の扱い方の確認
ActiveSupport::TimeZone
クラスを用いる