I have a timestamp in a row in my MySQL DB, and I can output the
timestamp, but what method could I use to turn the timestamp into the
date, like the PHP function date()?
Also, can I have the link to any place that lists all RoR
Methods/Classes that is not the official one? If no other ones exist, no
problem
Hi,
mytimestamp.to_date() should work.
Not sure, but this might be edge rails only.
Check out the docs here:
http://rubymanual.org/module/ActiveSupport%3A%3ACoreExtensions%3A%3ATime%3A%3AConversions#meth_to_date
Eric
Michael B. wrote:
I have a timestamp in a row in my MySQL DB, and I can output the
timestamp, but what method could I use to turn the timestamp into the
date, like the PHP function date()?
Also, can I have the link to any place that lists all RoR
Methods/Classes that is not the official one? If no other ones exist, no
problem
–
Eric G.
ericgoodwin.com
Eric,
Nope, that gives me the undefinded method error.
Are you running edge rails or are you running 1.0?
Edge rails seems quite stable and has quite a bit of added functionality
in it including the to_date function.
Trying running rake freeze_edge to get the latetest into your plugins
directory.
Other than that you can write your own helper.
Rails converts mysql datetime’s into a Time so …
class Time
to_date()
Date.new(self.year, self.month, self.day)
end
end
They must be other ways too, but that should work.
Eric
Michael B. wrote:
Eric,
Nope, that gives me the undefinded method error.
–
Eric G.
ericgoodwin.com