Created
May 1, 2025 08:19
-
-
Save FrankApiyo/1e6398674356a5aec78bdc491a99465b to your computer and use it in GitHub Desktop.
Timex timezone conversion
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
result = | |
case Timex.parse(datetime_str, "{ISO:Extended}") do | |
{:ok, datetime} -> | |
datetime | |
|> Timex.to_datetime(from_tz) | |
|> Timex.Timezone.convert(to_tz) | |
|> Timex.format!("%Y-%m-%d %H:%M:%S %Z", :strftime) | |
_ -> | |
"Invalid datetime format" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment