Convert Date to DateTime

The method I am using to convert Date objects to DateTime objects is:

date_obj = DateTime.parse(Date.to_s)

Is this an okay way to go about doing this? Or is there a more
efficient way?

On Mon, Jun 1, 2009 at 7:44 PM, David [email protected] wrote:

The method I am using to convert Date objects to DateTime objects is:

date_obj = DateTime.parse(Date.to_s)

Is this an okay way to go about doing this? Or is there a more
efficient way?

Well, on Rails you can do

date_obj.to_date_time

It’s part of ActiveSupport


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

I think it’s date_obj.to_datetime