Hermanverschooten
Calendar default format for strftime
Is there a way to set a default format for Calendar.strftime/3?
I see in the documentation you can give a :preferred_datetime, :preferred_date or :preferred_time option that will then be used for %c, %x or %X respectively.
But I was wondering if these could be set in config for example, globally.
Marked As Solved
Hermanverschooten
That’s a shame.
I would prefer not to add a dependency just for that, own module will have to do.
Thanks again, and a happy, healthy and prosperous 2025.
Also Liked
LostKobrakai
I don’t think so, but you could always wrap it in your own API. ex_cldr can iirc also give you strftime options.
Last Post!
Hermanverschooten
I think most cases will have 1 format, and setting a default format does not exclude giving the format on the function call.
In fact you still have to use one of the predefined qualifiers to select the predefined format.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #elixirconf-us
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









