[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

to_time doesn't do anything??

Guillaume Loader

3/17/2009 9:44:00 PM

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!
--
Posted via http://www.ruby-....

2 Answers

Guillaume Loader

3/17/2009 10:39:00 PM

0

Nobody knows?
--
Posted via http://www.ruby-....

Justin Collins

3/18/2009 3:05:00 AM

0

Guillaume Loader wrote:
> 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!
>

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