std.datetime.parseRFC822DateTime

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 21 03:28:16 PDT 2015


On Tuesday, April 21, 2015 08:14:10 Jakob Ovrum via Digitalmars-d-learn wrote:
> std.datetime contains parseRFC822DateTime to convert from an
> RFC822/RFC5322 formatted string (ala "Sat, 6 Jan 1990 12:14:19
> -0800") to a SysTime.
>
> Does it contain anything for the converse - converting from a
> SysTime to "Sat, 6 Jan 1990 12:14:19 -0800"?
>
> If not, should it?

No, it does not contain the reverse. It was added specifically for the
installer. If it weren't for that, std.datetime wouldn't support it at all.
It's a horrible format that should just die. The only reason to use it is
because the e-mail spec (and thus specs like HTTP) unfortunately uses it.
However, anyone that's going to need to generate the format for anything
like that is going to need a lot more than that that Phobos doesn't provide
anyway, so I really don't think that it's much of a loss. Regardless, I'm
strongly of the opinion that anything dealing with that format should be
restricted to a library for e-mail or HTTP, and if it weren't for the fact
that the installer needed to be able to read it (I forget why), I would have
argued strongly against adding parseRFC822DateTime to Phobos.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list