[erlang-questions] strftime for formatting dates and times

Jachym Holecek <>
Tue Jun 21 23:42:44 CEST 2011


# Kenny Stone 2011-06-21:
> https://github.com/kennystone/strftimerl
> 
> I literally copied ruby's strftime docs into the readme and implemented (almost) each type of
> formatting.
> 
> I'm considering patching the calendar module with this functionality.  Thoughts?
> 
> strftime:f(now(), "Printed on %m/%d/%Y").    %=> "Printed on 11/19/2007"
> strftime:f(now(), "at %I:%M%p").             %=> "at 08:37AM"
> strftime:f(now(), "at %I:%M%p", universal).  %=> "at 02:37PM"
> strftime:f(now(), "%D-%T.%N").               %=> "11/19/2007-08:38:02.445443"

Yet another weird formatting DSL for something that is more conveniently
done as iolists using calendar and perhaps a few helper functions.

Oh boy, am I a killjoy...

The timezone/dst/etc conversion API mentioned in another post would be
lovely though, preferrably using now() and/or datetime() as primary time
representations, like everything else does (just provide functions that
calculate the interesting bits when you need them, no?).

BR,
	-- Jachym



More information about the erlang-questions mailing list