HI Everybody, I have one date instant. I want to format the date using strftime method, and the result I want is 2008 Jan 06th Here How can I add the suffix with the day like (1st, 2nd, 3rd, 4th etc). Thanks with regards, Veeraa.T -- 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 -~----------~----~----~----~------~----~------~--~---
I don''t believe you''re going to get that directly using strftime. You''ll need to write your own helper method to return the day part with 1st, 2nd, etc. You could use strftime inside that helper to give you 2008 Jan 06 then concatenate the st, nd or th to the end of the string. That shouldn''t be too difficult to write. On Jan 6, 12:29 am, Veera Sundaravel <rails-mailing-l...@andreas- s.net> wrote:> HI Everybody, > > I have one date instant. I want to format the date using strftime > method, and the result I want is > > 2008 Jan 06th > > Here How can I add the suffix with the day like (1st, 2nd, 3rd, 4th > etc). > > Thanks with regards, > Veeraa.T > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
http://svn.webtest.wvu.edu/repos/rails/plugins/eztime/ might help. On Jan 6, 7:56 am, Robert Walker <rwalker...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I don''t believe you''re going to get that directly using strftime. > You''ll need to write your own helper method to return the day part > with 1st, 2nd, etc. You could use strftime inside that helper to give > you 2008 Jan 06 then concatenate the st, nd or th to the end of the > string. That shouldn''t be too difficult to write. > > On Jan 6, 12:29 am, Veera Sundaravel <rails-mailing-l...@andreas- > > s.net> wrote: > > HI Everybody, > > > I have one date instant. I want to format the date using strftime > > method, and the result I want is > > > 2008 Jan 06th > > > Here How can I add the suffix with the day like (1st, 2nd, 3rd, 4th > > etc). > > > Thanks with regards, > > Veeraa.T > > -- > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---