[phobos] User define datetime format

Jose Armando Garcia jsancio at gmail.com
Mon Jun 6 20:41:27 PDT 2011


On Tue, Jun 7, 2011 at 12:03 AM, Andrei Alexandrescu <andrei at erdani.com> wrote:
> Jose,
>
>
> I suggest you use simple Posix positional parameters. Jonathan has a few
> tips on how to make that fast. You should be able to get many formats that
> way.
>

I am planning to use positional parameters internally but I didn't
want the user to have to remember that %1$s is for timestamp, %2$x is
for thread id, etc. So instead I was thinking of having the user input
"%t %i" which internally gets translated to "%1$s %2$x" (I already
have the code for this).

%t would map to SysTime.toISOString(). If they wanted to create a
custom date/time format they use "%{...}t". So, for example "%{%a, %d
%b %Y %T %z}t" would result in "Tue, 07 Apr 2011 00:36:04 +0000".

Andrei, do you plan to submit your changes to formattedWrite which
allow a range of arguments. I can simplify some of my code with such a
feature ;)!

What does everyone think?
-Jose


More information about the phobos mailing list