I write my first project wich using Datamapper as ORM, so please be patient. 🙂
I try to do get String from DateTime field:
Error.first.submitted_at.to_s
=> “2009-08-24T12:13:32+02:00”
Returned String is not good for me. In ActiveRecord I can do something like that:
Error.first.submitted_at.to_s(:only_date)
or any other date formatter. Is somethig similar available in DataMapper or I must to use strftime method?
That’s a feature available using AcitveSupport. You can do
require 'activesupport'to get it. That might be overkill, though. You could also use#stampfrom Facets to do the same thing, but you have to set up the:only_dateformat:If you really want to use it with the
to_smethod, you can do that, too: