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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
<a href="http://corelib.rubyonrails.org/classes/ Time.html#M000264">strftime method</a> my_time.strftime("%d-%m-%Y") On Apr 23, 11:44 am, Rahul Ha <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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 > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nanyang Zhan wrote:> 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 > >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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---