Class: PG::TextEncoder::TimestampWithTimeZone

Inherits:
SimpleEncoder
  • Object
show all
Defined in:
lib/pg/text_encoder.rb

Constant Summary collapse

STRFTIME_ISO_DATETIME_WITH_TIMEZONE =
"%Y-%m-%d %H:%M:%S.%N %:z".freeze

Instance Method Summary collapse

Instance Method Details

#encode(value) ⇒ Object


21
22
23
# File 'lib/pg/text_encoder.rb', line 21

def encode(value)
	value.respond_to?(:strftime) ? value.strftime(STRFTIME_ISO_DATETIME_WITH_TIMEZONE) : value
end