E
E
eldar_web2017-01-11 18:49:55
Ruby on Rails
eldar_web, 2017-01-11 18:49:55

How to translate created_at in Ruby into the required format?

All models have the created_at field.
I want to bring it to dd.mm.yy hh:mm (01/11/2017 18:49), but I don’t know how to do it right away.
It is possible to separately output from this field, but how can you immediately?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Bordenyuk, 2017-01-11
@eldar_web

You can use strftime
or localize
l(article.created_at, format: '%e %B %Y')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question