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
#=> 2025-02-27 12:35:49.650986908 +0000
t.strftime("%F")
#=> "2025-02-27"

Executed with Ruby 3.4.2