ruby format date time
# Step 1: Require the 'date' module to access date and time-related functionality
require 'date'
# Step 2: Get the current date and time
current_datetime = DateTime.now
# Step 3: Format the date and time as a string using the strftime method
formatted_datetime = current_datetime.strftime("%Y-%m-%d %H:%M:%S")
# Step 4: Print or use the formatted date and time
puts formatted_datetime