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-02
:db
2026-02-02 01:04:35
20260202
:number
20260202010435
:time
01:04
02 Feb
:short
02 Feb 01:04
February 02, 2026
:long
February 02, 2026 01:04
February 2nd, 2026
:long_ordinal
February 2nd, 2026 01:04
02 Feb 2026
:rfc822
Mon, 02 Feb 2026 01:04:35 +0000
:iso8601
2026-02-02T01:04:35+0000
date source
time source
This code paraphrases the #to_formatted_s docs.
#to_formatted_s