Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time#new(iso8601, in: nil)を追加 #2886

Merged
merged 2 commits into from
May 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions refm/api/src/_builtin/Time
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,26 @@ zone に nil を指定した場合の値は、現在のタイムゾーンに従
p Time.new(2008, 6, 21, 13, 30, 0, "+09:00") # => 2008-06-21 13:30:00 +0900
#@end

#@since 3.2
--- new(iso8601, in: nil) -> Time
引数で指定した地方時の Time オブジェクトを返します。

@param iso8601 Time#inspectの結果や制限されたISO-8601形式などの文字列を指定します。

@param in 協定世界時との時差を、秒を単位とする整数か、
"UTC" かミリタリータイムゾーンの文字列または
"+HH:MM" "-HH:MM" 形式の文字列で指定します。
iso8601 に指定された文字列がタイムゾーンを持っている場合は無視されます。

@raise ArgumentError iso8601が無効な形式の場合に発生します。

#@samplecode
p Time.new("2024-02-15 10:20:30") # => 2024-02-15 10:20:30 +0900
p Time.new("2024-02-15 10:20:30 UTC", in: "+0800") # => 2024-02-15 10:20:30 UTC
p Time.new("2024-02-15 10:20:30", in: "+0800") # => 2024-02-15 10:20:30 +0800
#@end
#@end

== Instance Methods

--- +(other) -> Time
Expand Down