Skip to the content.

format.rb(date)

The overall purpose of the code is to capture the current date and time and then convert it into a string formatted as “YYYY-MM-DD”.

Execution:

t = Time.now
#=> 2024-12-08 04:08:10.874551559 +0000
t.strftime("%F")
#=> "2024-12-08"

Executed with Ruby 3.3.6