Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Rubyでエポック時間を標準形式に変換する簡単な方法はありますか?もしそうなら、それが表示される方法をカスタマイズできますか?
Time.at次の方法を使用します。
Time.at
Time.at(1234567890) #=> 2009-02-13 16:31:30 -0700
strftime時間を表示するには、結果のオブジェクトでメソッドを使用できます。
strftime
例えば:
Time.at(1234567890).strftime("%m/%d/%Y") #=> "02/13/2009"