Class: ETL::Transform::StringToDateTimeTransform

Inherits:
Transform show all
Defined in:
lib/etl/transform/string_to_date_time_transform.rb

Overview

Transform a String representation of a date to a DateTime instance

Instance Attribute Summary

Attributes inherited from Transform

#configuration, #control, #name

Instance Method Summary (collapse)

Methods inherited from Transform

benchmarks, #initialize, transform

Constructor Details

This class inherits a constructor from ETL::Transform::Transform

Instance Method Details

- (Object) transform(name, value, row)

Transform the value using DateTime.parse.

WARNING: This transform is slow (due to the Ruby implementation), but if you need to parse timestamps before or after the values supported by the Time.parse.



9
10
11
# File 'lib/etl/transform/string_to_date_time_transform.rb', line 9

def transform(name, value, row)
  DateTime.parse(value) unless value.nil?
end