Create an initializer for it:
# config/initializers/time_formats.rb
Add something like this to it:
Time::DATE_FORMATS[:custom_datetime] = "%d.%m.%Y"
And then use it the following way:
post.updated_at.to_s(:custom_datetime)
?? Your have to restart rails server for this to work.
Check the documentation for more information: http://api.rubyonrails.org/v5.1/classes/DateTime.html#method-i-to_formatted_s