Formatting a birthday in years
You could cut out some of those intermediate variables using the pipeline operator: |&gt;

def age_post(post) do
  birthday = Timex.date({post.birthday_year, post.birthday_month, post.birthday_day})

  (Date.now |&gt; Timex.diff(birthday, :years) |&gt; Integer.to_string) &lt;&gt; " ans"
end