Method: Sequel::SequelMethods#string_to_datetime

Defined in:
lib/sequel/core.rb

#string_to_datetime(string) ⇒ Object

Converts the given string into a Time or DateTime object, depending on the value of Sequel.datetime_class.

Sequel.string_to_datetime('2010-09-10 10:20:30') # Time.local(2010, 09, 10, 10, 20, 30)

305
306
307
308
309
310
311
312
313
# File 'lib/sequel/core.rb', line 305

def string_to_datetime(string)
  if datetime_class == DateTime
    DateTime.parse(string, convert_two_digit_years)
  else
    datetime_class.parse(string)
  end
rescue => e
  raise convert_exception_class(e, InvalidValue)
end