提交 53cc85fa 编写于 作者: F Francesco Rodriguez

added docs to String#to_date

上级 7bf6edf8
......@@ -15,6 +15,12 @@ def to_time(form = :utc)
end
end
# Converts a string to a Date value.
#
# "1-1-2012".to_date #=> Sun, 01 Jan 2012
# "01/01/2012".to_date #=> Sun, 01 Jan 2012
# "2012-12-13".to_date #=> Thu, 13 Dec 2012
# "12/13/2012".to_date #=> ArgumentError: invalid date
def to_date
unless blank?
date_values = ::Date._parse(self, false).values_at(:year, :mon, :mday)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册