axelson

axelson

Scenic Core Team

ElixirConf 2019: Date, Time, and Time Zones in Elixir 1.9 - Lau Taarnskov

by @Lau

Elixir 1.8 and 1.9 bring changes to the date & time features in Elixir. This talk will go through how to get the most out of Elixir, as it stands now, for date and time functionalities.

Date and time are a part of every Elixir project. Whether it be timestamps in logs, databases, or business logic, date and time issues have the potential to cause significant problems if you are not prepared.

The TimeZoneDatabase behavior in Elixir 1.8+ allows using time zone functionality directly in the standard library. We’ll walk through examples of how to use it and take advantage of the potential for fewer dependencies.

We will look at the different built-in types for date and time in Elixir. And when to use which one. Choosing the correct type is about semantics, meaning, representing information and data you have available, and avoiding creating fake data. This makes it easier for other developers, other libraries, and other systems to make the most of your date and time data.

We will also look at the new UTC DateTime sigil introduced in Elixir 1.9.

Learn about persisting the date and time types in databases with Ecto 3.

Civil time used today ultimately is tied to how the earth and sun move in relation to each other. This affects leap seconds, which are part of UTC. Besides that, there are many time zones which are determined politically and can change often and with short notice. In certain cases, this can be ignored. The types NaiveDateTime, Date and Time follow rules that do not change often because they are not concerned with these issues. But DateTime depend on an ever-changing database concerning time zones.

How do we keep the time zone database up to date whether deploying to a web server using Phoenix, using containers or to a Nerves device? There are different ways of doing that with different tradeoffs.

Besides looking at how to configure the Tzdata library to use with the TimeZoneDatabase behavior, also get a behind the scenes look at how this library evolved over the last five years. See how both macros and ETS have been used, and which tradeoffs have been made for performance improvements.

View all threads tagged with time
View all elixirconf2019 talks

Where Next?

Popular in Talks Top

axelson
ElixirConf US 2018 – Introducing Scenic - A Functional UI Framework – Boyd Multerer (@boydm) After years of...
New
New
axelson
ElixirConf 2017 - Working with legacy databases in Ecto - @geo Often when starting an Elixir or Phoenix proj...
New
kokolegorille
Lonestar Elixir 2018 videos are starting to pop up :slight_smile: https://www.youtube.com/channel/UCOy-_b9bqjokoWX9Hg5ZgUg Day 1 Chris ...
New
axelson
Here’s today’s talk: ElixirConf 2017 - Don’t Write Macros But Do Learn How They Work - by @jessejanderson ...
New
axelson
ElixirConf 2017 - Day 2 Morning Keynote - @josevalim All talks are available in the Elixir Conf 2017 Talks Li...
New
axelson
ElixirConf 2017 - The Power of Zero - Andrew Forward Automation is hard, but the benefits can be phenomenal....
New
axelson
by @zacky1972 Finally, we’ve succeeded in the implementation of Hastega!!! (Maybe until ElixirConf US 2019 :slight_smile: Hastega (Hyp...
New
axelson
ElixirConf US 2018 – Building Video Chat with Elixir & Phoenix – Anil Wadghule (@anildigital) In this t...
New
AstonJ
Keywords: LiveView autocomplete, LiveView search, focus Startups and web developers take note. Phoenix LiveView is the revolutionary fr...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement