class ActiveSupport::TimeWithZone

def to_s(format = NOT_SET)

Experimental RBS support (using type sampling data from the type_fusion project).

def to_s: (?Object format) -> String

This signature was generated using 2 samples from 1 application.

Returns a string of the object's date and time.
def to_s(format = NOT_SET)
  if format == :db
    ActiveSupport::Deprecation.warn(
      "TimeWithZone#to_s(:db) is deprecated. Please use TimeWithZone#to_fs(:db) instead."
    )
    utc.to_fs(format)
  elsif formatter = ::Time::DATE_FORMATS[format]
    ActiveSupport::Deprecation.warn(
      "TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_fs(#{format.inspect}) instead."
    )
    formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
  elsif format == NOT_SET
    if formatter = ::Time::DATE_FORMATS[:default]
      ActiveSupport::Deprecation.warn(
        "Using a :default format for TimeWithZone#to_s is deprecated. Please use TimeWithZone#to_fs instead."
      )
      formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter)
    else
      "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
    end
  else
    ActiveSupport::Deprecation.warn(
      "TimeWithZone#to_s(#{format.inspect}) is deprecated. Please use TimeWithZone#to_fs(#{format.inspect}) instead."
    )
    "#{time.strftime("%Y-%m-%d %H:%M:%S")} #{formatted_offset(false, 'UTC')}" # mimicking Ruby Time#to_s format
  end
end