Sha256: 970d66d6304c3eb3892a8b79eb9df7a795a70aa21ae75620911177e4d1cf5bcf
Contents?: true
Size: 889 Bytes
Versions: 24
Compression:
Stored size: 889 Bytes
Contents
module MultiSolr::Utils # Convert date-string from Solr into Ruby Time-Instance # Params: # solr_date_string: Date as String ("2012-06-29T12:43:30Z") # returns # Ruby Time-Instance at UTC-Base def solr_datetime_to_ruby_time solr_date_string return nil if solr_date_string.blank? Time.utc solr_date_string[0..3], solr_date_string[5..6], solr_date_string[8..9], solr_date_string[11..12], solr_date_string[14..15], solr_date_string[17..18] end # Convert date-string from Solr into Ruby Time-Instance # Params: # ruby_time_instance: Time-Instance # returns # Time as String in Solr-Format ("2012-06-29T12:43:30Z") def ruby_time_to_solr_datetime ruby_time_instance return nil if ruby_time_instance.nil? ruby_time_instance.strftime('%Y-%m-%dT%H:%M:%SZ') end module_function :solr_datetime_to_ruby_time, :ruby_time_to_solr_datetime end
Version data entries
24 entries across 24 versions & 1 rubygems