Hi all,
I am using InstantRails with MySQL-Front. Date is stored in format
yyyy-mm-dd
in database. I want to retrieve and show date in dd-mm-yyyy in my
view.rhtml.
How can I change it to dd-mm-yyyy form.
Please help me out.
Thanks
Hi all,
I am using InstantRails with MySQL-Front. Date is stored in format
yyyy-mm-dd
in database. I want to retrieve and show date in dd-mm-yyyy in my
view.rhtml.
How can I change it to dd-mm-yyyy form.
Please help me out.
Thanks
Rahul Ha wrote:
How can I change it to dd-mm-yyyy form.
Please help me out.
there may be a method to do this job,
at least you can code a helper yourself, like
def my_date(date)
“#{date.day}-#{date.month}-#{date.year}”
end
Nanyang Z. wrote:
“#{date.day}-#{date.month}-#{date.year}”
end
If you just need to reformat the date object when you print it, look at
the strftime function in the API.
http://corelib.rubyonrails.org/classes/Time.html#M000264
Cheers
Mohit.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs