instance method
quoted_date
Ruby on Rails 5.2.8.1
Since v2.2.3Signature
quoted_date(value)
Quote date/time values for use in SQL input. Includes microseconds if the value is a Time responding to usec.
Parameters
-
valuereq
Source
# File activerecord/lib/active_record/connection_adapters/abstract/quoting.rb, line 115
def quoted_date(value)
if value.acts_like?(:time)
zone_conversion_method = ActiveRecord::Base.default_timezone == :utc ? :getutc : :getlocal
if value.respond_to?(zone_conversion_method)
value = value.send(zone_conversion_method)
end
end
result = value.to_s(:db)
if value.respond_to?(:usec) && value.usec > 0
"#{result}.#{sprintf("%06d", value.usec)}"
else
result
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/quoting.rb line 115
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::Quoting