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!

Summary

blank?(value)

We can let Ecto handle blank input

cast(datetime)

Handle casting to Timex.Ecto.DateTimeWithTimezone

dump(datetime)

Convert to the native Ecto representation

load(arg1)

Load from the native Ecto representation

type()

Callback implementation for c:Ecto.Type.type/0

Functions

blank?(value)

We can let Ecto handle blank input

cast(datetime)

Handle casting to Timex.Ecto.DateTimeWithTimezone

dump(datetime)

Convert to the native Ecto representation

load(arg1)

Load from the native Ecto representation

type()

Callback implementation for c:Ecto.Type.type/0.