[Rails] Re: Convert Date to Time

Mikkel Bruun devlists-rubyonrails at devlists.com
Wed Mar 1 13:00:25 GMT 2006


mb>ruby script/console
Loading development environment.
>> t = Time.new
=> Wed Mar 01 13:59:31 W. Europe Standard Time 2006
>> d = t.to_date
=> #<Date: 4907591/2,0,2299161>
>> d.class
=> Date
>> t = d.to_time
=> Wed Mar 01 00:00:00 W. Europe Standard Time 2006
>> t.class
=> Time
>>


On Wednesday, March 01, 2006, at 1:46 PM, Chris wrote:
>Thanks Mathias!,
>
>but what i was looking for is this :
>
>a=Time.new
>d=a.to_date()
>
>AND
>
>a=Date.new
>t=a.to_time()
>
>Chris
>
>--
>Posted via http://www.ruby-forum.com/.
>_______________________________________________
>Rails mailing list
>Rails at lists.rubyonrails.org
>http://lists.rubyonrails.org/mailman/listinfo/rails


Mikkel Bruun

www.strongside.dk    - Football Portal(DK)
nflfeed.helenius.org - Football News(DK)
ting.minline.dk      - Buy Old Stuff!(DK)




-- 
Posted with http://DevLists.com.  Sign up and save your time!


More information about the Rails mailing list