0

Now when I add something to my database it enter created_at parameter also. When I use it in my view, it looks like this:

Thursday, 11 Jun 2015 9:52 AM

And I use it as:

<%= @current_feed.created_at.strftime("%A, %d %b %Y %l:%M %p") %>

Can I translate month and weekdays? Or create dictionary for it?

2 Answers2

0

Try this .......

date = Date.parse('Thursday, 11 Jun 2015 9:52 AM')
 => Thu, 11 Jun 2015 
date.mon
 => 6 
date.mday
 => 11 
date.wday
 => 4

Hope this will work for you.

Akshay Borade
  • 2,442
  • 12
  • 26
0

I guess you are asking about date translation. Have a look at this question.

You should use I18n.localize. Refer this document.

You can also have a look at this question, to know how to have months in locale.

Community
  • 1
  • 1
BinaryMee
  • 2,102
  • 5
  • 27
  • 46