提交 a192e5f7 编写于 作者: J Jon Moss 提交者: GitHub

Merge pull request #28782 from kmayer/kmayer-doc-to-time

Add more explanation to to_time about timezones
......@@ -79,6 +79,9 @@ def readable_inspect
# date.to_time(:local) # => 2007-11-10 00:00:00 0800
#
# date.to_time(:utc) # => 2007-11-10 00:00:00 UTC
#
# NOTE: The :local timezone is Ruby's *process* timezone, i.e. ENV['TZ']
# If the *application's* timezone is needed, then use +in_time_zone+ instead
def to_time(form = :local)
raise ArgumentError, "Expected :local or :utc, got #{form.inspect}." unless [:local, :utc].include?(form)
::Time.send(form, year, month, day)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册