Quote date/time values for use in SQL input. Includes microseconds if the
value is a Time responding to usec.
# File activerecord/lib/active_record/connection_adapters/abstract/quoting.rb, line 114
def quoted_date(value)
if value.acts_like?(:time)
if ActiveRecord::Base.default_timezone == :utc
value = value.getutc if value.respond_to?(:getutc) && !value.utc?
else
value = value.getlocal if value.respond_to?(:getlocal)
end
end
result = value.to_s(:db)
if value.respond_to?(:usec) && value.usec > 0
result << "." << sprintf("%06d", value.usec)
else
result
end
end