Module: JayAPI::Elasticsearch::Time

Included in:
PropertiesFetcher, RSpec::TestDataCollector
Defined in:
lib/jay_api/elasticsearch/time.rb

Constant Summary collapse

TIME_FORMAT =

Time format accepted by elasticsearch

'%Y/%m/%d %H:%M:%S'

Instance Method Summary collapse

Instance Method Details

#format_time(time) ⇒ String

Transforms a Time object to a time format that is recognized by elasticsearch

Parameters:

  • time (Time)

    The time to convert

Returns:

  • (String)

    The time converter to a string, parseable by ES



13
14
15
# File 'lib/jay_api/elasticsearch/time.rb', line 13

def format_time(time)
  time.getutc.strftime(TIME_FORMAT)
end