digitalmars.D.learn - std.datetime.parseRFC822DateTime
- Jakob Ovrum (6/6) Apr 21 2015 std.datetime contains parseRFC822DateTime to convert from an
- Jonathan M Davis via Digitalmars-d-learn (13/19) Apr 21 2015 No, it does not contain the reverse. It was added specifically for the
- Jakob Ovrum (5/37) Apr 21 2015 I needed it for the If-Modified-Since HTTP header, through
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?
Apr 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
Apr 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: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.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
Apr 21 2015