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 2017 - Well Behaved Native Implemented Functions for Elixir - @potatosalad Native Implemented Fun...
New
axelson
ElixirConf 2017 - Building Realtime Mobile Apps with React Native and Elixir - Osayame Gaius Obaseki Buildin...
New
axelson
ElixirConf US 2018 – Texas: Virtual DOM Library for Server-Side V-DOM. – Dan McGuire (@dgmcguire) Client-side applicatio...
New
ElixirConf
ElixirConf: ElixirConf 2023 - Charlie Holtz - Building AI Apps with Elixir Comments welcome! View the <span class="hashtag-icon-placehol...
New
axelson
by @takasehideki Can you imagine that your Elixir code will be executed as a hardware circuit on an FPGA? The FPGA (Field-Programmable...
New
axelson
Hey folks, beginning to post today’s round of ElixirConf videos! ElixirConf US 2018 – Elixir at a Walking Pace – Lance Halvorsen (@lance...
New
Lawrence_elixir
@voltone - Security advocate, BEAM enthusiast Learn you some ‘ssl’ for much security! Talk in three words: TLS, security, troubleshooti...
New
axelson
ElixirConf 2017 - Live APIs with GraphQL Subscriptions - @bruce and @benwilson512 APIs have gone live with G...
New
axelson
Consistent, Distributed Elixir - @keathley Elixir and Erlang provide powerful mechanisms for building systems that are alw...
New
axelson
by @jon At PagerDuty, we run our systems across many geographic regions to ensure we’re always available, even when you might not be. E...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New

We're in Beta

About us Mission Statement