Thread overview
std.datetime.parseRFC822DateTime
Apr 21, 2015
Jakob Ovrum
Apr 21, 2015
Jonathan M Davis
Apr 21, 2015
Jakob Ovrum
April 21, 2015
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?
April 21, 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

April 21, 2015
On Tuesday, 21 April 2015 at 10:28:32 UTC, Jonathan M Davis wrote:
> 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

I needed it for the If-Modified-Since HTTP header, through std.net.curl.HTTP.addRequestHeader.

Phobos has HTTP support and this is the preferred date format according to spec. Phobos should support it.