ok!!! cool dude

 I got it
 we can use like this
str=10 am
t=Time.parse(str)
t.split(" ")[3]

On Fri, Jan 20, 2012 at 3:28 PM, Michael Pavling <pavl...@gmail.com> wrote:

> On 20 January 2012 09:52, Santosh Kumar Mohanty
> <sant...@railsfactory.org> wrote:
> >   Here is the executed code for time
> > irb(main):001:0> t=Time.now
> > => Fri Jan 20 14:47:46 +0530 2012
> > irb(main):002:0> t=t.to_s
> > => "Fri Jan 20 14:47:46 +0530 2012"
> > irb(main):003:0> t.split(" ")
> > => ["Fri", "Jan", "20", "14:47:46", "+0530", "2012"]
> > irb(main):004:0> t.split(" ")[3]
> > => "14:47:46"
> >
>
> So you've added a ".to_s" that you didn't mention before... ;-)
>
> But wouldn't it be easier to do :
>  Time.now.strftime("%T")
> ?
>
> But either way, you're not addressing the OP, as that was regarding
> turning String into Time, not Time to String.
>
> --
> 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@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to