Hermanverschooten

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

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

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

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.

Where Next?

Popular in Questions Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44778 311
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

We're in Beta

About us Mission Statement