I’m having some trouble with
So I have a form that accept
end_time which both in
utc_datetime and inside a
The problem is that I’m in Malaysia so the booking that is created will be in UTC and when I convert it to
timex, it will show a different time.
start_time: 2019-09-08 22:00:00
end_time: 2019-09-08 23:00:00
when convert it using
start_time: 2019-09-09 06:00:00
end_time: 2019-09-09 07:00:00
Now I see that I have 2 options:
utc_datetimeand store the timezone in a separate column
- Manipulate the
end_timefrom the form and shift it to the UTC timezone which I already tried and failed.
changeset |> put_change(:start_time, Timex.shift(Timex.to_datetime(start_time, "Asia/Kuala_Lumpur"), "Etc/UTC")) |> put_change(:end_time, Timex.shift(Timex.to_datetime(end_time, "Asia/Kuala_Lumpur"), "Etc/UTC"))
I’m not sure if I did it correctly or not and I’m not sure which is the best way
Thanks for your help in advance!