Method: BBLib::HashPathProcs._parse_date
- Defined in:
- lib/hash_path/processors.rb
._parse_date(value, patterns, format) ⇒ Object
126 127 128 129 130 131 132 133 134 |
# File 'lib/hash_path/processors.rb', line 126 def self._parse_date(value, patterns, format) formatted = nil patterns.each do |pattern| next unless formatted.nil? formatted = Time.strptime(value.to_s, pattern.to_s) rescue nil formatted = formatted.strftime(format) if format end formatted end |