Proposal for custom time string formatting in std.datetime
smjg_1998 at yahoo.com
Fri Dec 23 04:02:26 PST 2011
On 23/12/2011 11:23, Jonathan M Davis wrote:
> So, your flags are even more restrictive than I understood them to be. You
> can't have multiple-character flags unless they're the same letter. I thought
> that you could. That _does_ avoid the problem that I was describing, but the
> result is too limiting IMHO. It certainly makes it hard to add flags for
> specific formats similar to %ctime or %mpeg7.
What is the use case for including a full date in some externally defined format within a
longer formatted date string? ISTM the way to do this is to define a function that just
generates this format straight off. In my library, toShortFormatString and
toLongFormatString are already examples of this.
> It also means that you can't reuse letters.
At the moment only 12 letters are used. I can't see the whole alphabet being used up any
time in the foreseeable future.
> It's possible that your scheme is somewhat easier to use for the most basic
> cases, but as soon as more specific and/or complicated schemes are needed (e.g.
> mpeg-7 or any of the ISO schemes), I don't think it works as well in general.
I think I could expand my scheme to include ISO signed-year notation easily enough. In
the mpeg-7 standard, does the denominator of the fractional second have to be the smallest
possible power of 10, or is F20/1000 or F0/1000 allowed just as well?
More information about the Digitalmars-d