There are also libraries for this purpose, such as https://hex.pm/packages/datix and https://hex.pm/packages/date_time_parser.
On Tue, Sep 13, 2022 at 1:45 PM Bartolomeo <[email protected]> wrote: > I noticed most of countries still haven't adopted ISO 8601 > https://en.wikipedia.org/wiki/Date_format_by_country > wtorek, 13 września 2022 o 13:26:19 UTC+2 Bartolomeo napisał(a): > >> I'd love to have in standard library ability to parse date strings with >> custom formatters defined by accepted formats >> <https://hexdocs.pm/elixir/1.12/Calendar.html#strftime/3-accepted-formats> >> Calendar >> has in place. >> >> I found few libraries that allows me to do this like: >> >> https://elixirforum.com/t/datix-a-date-time-parser-using-calendar-strftime-format-strings/36824 >> or >> https://elixirforum.com/t/date-formats-phoenix-and-ecto/5220/19 >> >> To avoid multiple regexes or dependencies to fulfill different client >> needs it could support formats provided in second arg of ie. >> `Date.parse_date("21/05/1985", "%d/%m/%Y")`, it would be opposite of >> `Calendar.strftime` so it would parse a given string, to the date, time or >> datetime. >> > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/8d93b269-5059-43dd-adea-26eb6b08563cn%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/8d93b269-5059-43dd-adea-26eb6b08563cn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4LAAe93Ajkanu%3D%2BBk1mGWcJMECuUA1Ohf79J1trNnA1KA%40mail.gmail.com.
