Today I Learned

A Hashrocket project

Ready to join Hashrocket? Find Openings here and apply today.

Ecto timestamps as utc_datetime

When you define your Ecto schema with timestamps the default is to use naive_datetime but you have an option to specify utc_datetime if that’s what you want:

schema "products" do
  ...
  
  timestamps(type: :utc_datetime)
end
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.