Reg:Convesion of string to date

14 views
Skip to first unread message

VIDYA SAGAR POGIRI

unread,
Jul 15, 2015, 8:06:07 AM7/15/15
to rubyonra...@googlegroups.com
Hi i want to convert my string into date using ruby 

Jun 28 2015 to 06/28/2015. Can you help

Fernando Kakimoto

unread,
Jul 15, 2015, 8:36:48 AM7/15/15
to rubyonra...@googlegroups.com
Have you tried :

require 'active_support/time'
Time.parse('2015-07-15')

Att,
Fernando

On Wed, Jul 15, 2015 at 9:06 AM, VIDYA SAGAR POGIRI <vidyasag...@gmail.com> wrote:
Hi i want to convert my string into date using ruby 

Jun 28 2015 to 06/28/2015. Can you help

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/14e9b8f6-caf6-4578-9f32-bdb8d6360d88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Elizabeth McGurty

unread,
Jul 15, 2015, 11:26:55 AM7/15/15
to rubyonra...@googlegroups.com
http://ruby-doc.org/stdlib-2.1.1/libdoc/date/rdoc/Date.html
http://apidock.com/ruby/DateTime/strftime

require 'date'
Date.parse('Jun 28 2015').strftime('%m/%d/%Y')

irb(main):003:0> Date.parse('Jun 28 2015').strftime('%m/%d/%Y')
=> "06/28/2015"
Reply all
Reply to author
Forward
0 new messages