This code
Calendar.strftime(post.inserted_at, "%l:%M%P %A, %B %-d, %Y")
produces this error
invalid strftime format: %l
even though the %l
option is documented here.
Any idea why? I’m running elixir 1.14.2.
This code
Calendar.strftime(post.inserted_at, "%l:%M%P %A, %B %-d, %Y")
produces this error
invalid strftime format: %l
even though the %l
option is documented here.
Any idea why? I’m running elixir 1.14.2.
More then likely you want to use the docs here: Calendar behaviour
So, in your case you probably want:
Calendar.strftime(post.inserted_at, "%-I:%M%P %A, %B %-d, %Y")
Notice the %-I
. See Accepted padding options in that section.
That worked; thanks!!
For others that may not have noticed: The original link is for the Hex package calendar by Lau Taarnskov. The latter link is for the Elixir stdlib module called Calendar. Unfortunately they share the same name, IIRC the Hex package existed before Elixir’s own Calendar module.