method
    
    string_to_time
 
  string_to_time(string)
  public
  
    Hide source    
    
      
  
# File activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 112 def self.string_to_time(string) return string unless string.is_a?(String) time_hash = Date._parse(string) time_hash[:sec_fraction] = microseconds(time_hash) time_array = time_hash.values_at(:year, :mon, :mday, :hour, :min, :sec, :sec_fraction) # treat 0000-00-00 00:00:00 as nil Time.send(Base.default_timezone, *time_array) rescue DateTime.new(*time_array[0..5]) rescue nil end

 RSpec
RSpec Ruby on Rails
Ruby on Rails Ruby
Ruby 
   
   
    
    
     
    
