Doc needs help
The table below gives some format strings for popular time representations. RFC1123 is used by HTTP.
This is obsolete (and also confusing: RFC 1123: "Requirements for Internet Hosts -- Application and Support" (1989) has nothing in particular to say about date-time formats, except in the context of SMTP, where it refers to RFC 822. The original HTTP spec indeed refers to RFC 1123. That's likely an error.)
The current spec is in RFC 7231: Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content, more precisely:
Where we read:
An example of the preferred format is
Sun, 06 Nov 1994 08:49:37 GMT ; IMF-fixdate
(Yes, the obsolete
GMT is actually mandatory here)
%a, %d %b %Y %T GMT is not guaranteed to generate a valid datetime for HTTP as
%b are local-dependent!
- Obligatory: XKCD: ISO 8601
- Dan Bernstein (developer of "postfix" mail server among others) on UTC, TAI, and UNIX time
- Apache Web Server default logfile timestamp format
- Wikipedia: ISO8601
- Wikipedia: ISO8601 Combined date and time representations, the one with the letter
Tbetween date and time, as in
- POSIX stftime
- GNU libc strftime
- RFC5322 Date and Time Specification
- RFC5322 Obsolete Date and Time
- RFC5322 The Origination Date Field
RFC 5322 format string
Actually, %a and %b should not be used for RFC 5322 conformant datetime generation as they are not guaranteed to yield weekday/month names conformant to the specification. What they yield depends on the locale setting, for example, you may get french weekday names.
?- get_time(T),format_time(string(Text),"%a, %d %b %Y %T %z",T). T = 1620459465.1746278, Text = "Sat, 08 May 2021 09:37:45 +0200".