Created
October 2, 2018 13:28
-
-
Save wikiti/deb9617b87c520c98a4a1b7bfd28f94e to your computer and use it in GitHub Desktop.
Parse any datetime string on any known timezone
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
# Fetch a Rails timezone, and use it to parse a string | |
ActiveSupport::TimeZone[time_zone].parse(str) | |
# For example: | |
ActiveSupport::TimeZone['Madrid'].parse('2018-08-30 14:36') | |
# Thu, 30 Aug 2018 14:36:00 CEST +02:00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment