Time.zone.now.to_fs(:symbol)
Time.zone.now.to_formatted_s(:symbol)
pre-Rails 7
Time.zone.now.to_s(:symbol)
date
:symbol
time
2026-02-22
:db
2026-02-22 17:52:01
20260222
:number
20260222175201
:time
17:52
22 Feb
:short
22 Feb 17:52
February 22, 2026
:long
February 22, 2026 17:52
February 22nd, 2026
:long_ordinal
February 22nd, 2026 17:52
22 Feb 2026
:rfc822
Sun, 22 Feb 2026 17:52:01 +0000
:iso8601
2026-02-22T17:52:01+0000
date source
time source
This code paraphrases the #to_formatted_s docs.
#to_formatted_s