Ruby Quick Reference

Quick reference for efficient coding

View the Project on GitHub YumaYX/RubyQuickReference

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-10-10 15:57:31.02728735 +0000
t.strftime("%F")
#=> "2024-10-10"

Executed with Ruby 3.3.5