Reputation: 4999
I have a table in rails which ive used the default for timestamps.
For example in my applications table I have
applicant.created_at
to show when the application was submitted.
However this shows the full format of both date and time.
Is there a way for me just to display the date only in dd/mm/yyyy format?
Upvotes: 0
Views: 782
Reputation: 19789
There's a couple of great tutorials for formatting time.
http://railscasts.com/episodes/31-formatting-time
but what you are looking for is .strftime
t = Time.now
t.strftime("Printed on %m/%d/%Y")
puts t #=> "Printed on 11/14/2012"
Upvotes: 1