Trying to get some more clarity over
The documentation above suggests that while
NaiveDateTime doesn’t store any
TimeZone data associated with it,
DateTime seems to, however the former, when used,
Ecto seems to store timestamps (inserted_at, updated_at) in according to
UTC timezone anyway.
I read that using
utc_datetime “ensures” that dates are always converted to
utc before getting stored/retrieved from and to the database, however I am not sure what the significance of the “ensures” aspect here is, since
naive_datetime seems to do it anyway.
And I also think storing
timestamptz values in the database may not be really required, since I can just store
utc timestamps everywhere and user timezone preferences in another table and use these two pieces of info to convert accordingly before presenting to the users.
Can someone throw some light on what the real world significance in using
utc_datetime type for timestamps is? What am I missing here?