Created
May 16, 2018 11:40
-
-
Save yoggy/d41db19b57cdc6a6d7d11f7d5e661241 to your computer and use it in GitHub Desktop.
RubyのTime.parseはタイムゾーンが付いていない文字列をローカルタイムゾーンの時刻として解釈する。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ irb -r time | |
| irb(main):001:0> Time.parse("2018-1-1 0:0:0.0") | |
| => 2018-01-01 00:00:00 +0900 | |
| irb(main):002:0> Time.parse("2018-1-1 0:0:0.0 UTC") | |
| => 2018-01-01 00:00:00 UTC | |
| irb(main):003:0> Time.parse("2018-1-1 0:0:0.0 UTC").localtime | |
| => 2018-01-01 09:00:00 +0900 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment