3
module ActiveSupport #:nodoc:
4
module CoreExtensions #:nodoc:
6
# Converting strings to other objects
8
# 'a'.ord == 'a'[0] for Ruby 1.9 forward compatibility.
11
end if RUBY_VERSION < '1.9'
13
# Form can be either :utc (default) or :local.
14
def to_time(form = :utc)
15
::Time.send("#{form}_time", *::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec).map { |arg| arg || 0 })
19
::Date.new(*::Date._parse(self, false).values_at(:year, :mon, :mday))
23
::DateTime.civil(*::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec).map { |arg| arg || 0 })