To_time doesn't do anything?


#1

Hello everyone!

I have a date: creation_date which is a DateTime object. I want to
convert it in Time.
So I used the function to_time but there is no effect. My object remains
a DateTime object.

(rdb:1) creation_date
Sun, 15 Mar 2009 09:30:00 -0800
(rdb:1) creation_date.class
DateTime

(rdb:1) creation_date.to_time
Sun, 15 Mar 2009 09:30:00 -0800
(rdb:1) creation_date.to_time.class
DateTime

Could you help me, please?

Thank you!


#2

Nobody knows?


#3

Guillaume L. wrote:

DateTime

(rdb:1) creation_date.to_time
Sun, 15 Mar 2009 09:30:00 -0800
(rdb:1) creation_date.to_time.class
DateTime

Could you help me, please?

Thank you!

I don’t see this behavior.

ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]
irb 0.9.5(05/04/13)

irb(main):001:0> require ‘date’
=> true
irb(main):002:0> DateTime.now.class
=> DateTime
irb(main):003:0> DateTime.now.to_time
=> 2009-03-17 20:06:23 -0700
irb(main):004:0> DateTime.now.to_time.class
=> Time

-Justin