timex_ecto v3.4.0 Timex.Ecto.DateTimeWithTimezone
This is a special type for storing datetime + timezone information as a composite type.
To use this, you must first make sure you have the datetimetz
type defined in your database:
CREATE TYPE datetimetz AS (
dt timestamptz,
tz varchar
);
Then you can use that type when creating your table, i.e.:
CREATE TABLE example (
id integer,
created_at datetimetz
);
That's it!
Link to this section Summary
Functions
Handle casting to Timex.Ecto.DateTimeWithTimezone
Convert to the native Ecto representation
Load from the native Ecto representation
Returns the underlying schema type for the custom type.
Link to this section Functions
autogenerate(precision \\ :sec)
cast(datetime)
Handle casting to Timex.Ecto.DateTimeWithTimezone
dump(d)
Convert to the native Ecto representation
load(arg1)
Load from the native Ecto representation
type()
Returns the underlying schema type for the custom type.
For example, if you want to provide your own date
structures, the type function should return :date
.
Note this function is not required to return Ecto primitive types, the type is only required to be known by the adapter.
Callback implementation for Ecto.Type.type/0
.