Skip to content

Instantly share code, notes, and snippets.

@FrankApiyo
Created May 1, 2025 08:19
Show Gist options
  • Save FrankApiyo/1e6398674356a5aec78bdc491a99465b to your computer and use it in GitHub Desktop.
Save FrankApiyo/1e6398674356a5aec78bdc491a99465b to your computer and use it in GitHub Desktop.
Timex timezone conversion
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