↖️ Show all posts

Set standard date and time format in a rails app

create a new file called datetime_format.rb in config/initializers

# Date
Date::DATE_FORMATS[:default] = "%d/%m/%Y"
# Time
Time::DATE_FORMATS[:default] = "%d/%m/%Y %H:%M"

Restart Rails. Boom. show some love for 732 on stackoverflow


⬅️ Read previous Read next ➡️