[erlang-questions] strftime for formatting dates and times
Wed Jun 22 10:49:13 CEST 2011
On 2011-06-21, at 17:26 , Kenny Stone wrote:
> 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.
> 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"). %=>
Why not implement Unicode LDML's Date Format Pattern instead?
A second note is that using Ruby's strftime as your base may not be a good idea: it's not compatible with BSD libc's strftime (the extensions are different), though it might match POSIX's un-extended spec. I'd suggest either sticking to POSIX's strftime or using libc's as your base, rather than Ruby's.
More information about the erlang-questions