Reputation: 1902
I want a date time format which looks like this:- Tuesday, 27th December 2011 at 3:30 pm.
I made changed in the en.yml file to look like this
time:
format:
short_ref: "%A, %d %b at %I"
When I try to run the app I get this error : 18n::MissingTranslationData in Home#index
translation missing: en.time.formats.long
What might be causing this error?
Upvotes: 2
Views: 940
Reputation: 20920
Try using the strftime
function in ruby. That gives you a lot of flexibility in manipulating the date formats of ruby.
You can also try something similar to this :
date = Time.now
date.strftime("%d %b %Y at %I:%M:%S %p")
This will return the date in this format :
27 Dec 2011 at 05:47:20 PM
Learn more about the strftime
function in the Ruby API
Upvotes: 3