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-03-15
:db
2026-03-15 17:49:12
20260315
:number
20260315174912
:time
17:49
15 Mar
:short
15 Mar 17:49
March 15, 2026
:long
March 15, 2026 17:49
March 15th, 2026
:long_ordinal
March 15th, 2026 17:49
15 Mar 2026
:rfc822
Sun, 15 Mar 2026 17:49:12 +0000
:iso8601
2026-03-15T17:49:12+0000
date source
time source
This code paraphrases the #to_formatted_s docs.
#to_formatted_s