blob: cfb767d1f9fbc93de2b158cf7d63d0ca3986d1a1 (
plain) (
tree)
|
|
require 'parsedate'
module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module String #:nodoc:
# Converting strings to other objects
module Conversions
# Form can be either :utc (default) or :local.
def to_time(form = :utc)
::Time.send(form, *ParseDate.parsedate(self))
end
def to_date
::Date.new(*ParseDate.parsedate(self)[0..2])
end
end
end
end
end
|