Issue #14862 has been updated by mifrill (Aleksey Strizhak).


@Hanmac
Yeah, we can use strptime, but we still have problem, because the results is still the same, in details:

```
Time.strptime("Ends from 28 Jun 2018 12:00 BST".gsub(/Ends from/, "").lstrip, "%d %b %Y %H:%M %Z").zone

"MSK"

Time.strptime("Ends from 28 Jun 2018 12:00 BST".gsub(/Ends from/, "").lstrip, "%d %b %Y %H:%M %Z").utc.to_s

"2018-06-28 09:00:00 UTC"

```
This is incorrect results. The correctly results of this string correctly gather only by DateTime object:

```
DateTime.strptime("Ends from 28 Jun 2018 12:00 BST".gsub(/Ends from/, "").lstrip, "%d %b %Y %H:%M %Z").to_time.utc.to_s

"2018-06-28 11:00:00 UTC"
```

Yes, perhaps they looks like are different time zones, and because of this we got this behavior.

Different time zone with common abbr:

https://www.timeanddate.com/time/zones/bst
https://www.timeanddate.com/time/zones/bst-bougainville


but the problem is, the behavior is different for all three objects.

They can misunderstand the time zone, but should not the behavior be the same?

Thank you for your time.

----------------------------------------
Bug #14862: Time.parse does not handle the time zone
https://bugs.ruby-lang.org/issues/14862#change-72617

* Author: mifrill (Aleksey Strizhak)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
First I would like to thank you for your work, thank you

The point is:
```
Time.parse("Ends from 28 Jun 2018 12:00 BST").zone

"MSK"

DateTime.parse("Ends from 28 Jun 2018 12:00 BST").zone

"+01:00"
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>