What is the difference between RFC1123 and RFC2822 formatting DateTime in PHP?

This is out of curiosity, and not because I need to know this at the moment, but in the PHP manual they are identical; I see no reason why there are two different data formats for the same.

http://php.net/manual/en/class.datetime.php

const string RFC1123 = "D, d MYH:i:s O" ; const string RFC2822 = "D, d MYH:i:s O" ; 

Any clue?

+6
source share
2 answers

RFC1123 - β€œInternet Host Requirements - Application and Support,” October 1989

RFC2822 is the Internet Message Format, April 2001.

Think of RFC1123 as the parent for RFC2822 . He refers to RFC2822 as a suitable specification for a date / time that looks like this:

3.3. Date and time specification

Date and time are found in several header fields. This section defines the syntax of the full date and time specification. Although a folding space is allowed throughout the specification, it is RECOMMENDED that one space is used in every place where FWS appears (whether it is required or not necessary); some older implementations cannot interpret other cases of the correct addition of white space.

date-time = [day of the week], "] date FWS time [CFWS]

day of the week = ([FWS] day-name) / obs-day-of-week

day-name = "Mon" / "Tue" / "Wed" / "Thu" / "Fri" / "Sat" / "Sun"

date = day month year

year = 4 * DIGIT / obs-year

month = (FWS month-name FWS) / obs-month

month-name = "Jan" / "Feb" / "Mar" / "Apr" / "May" / "Jun" / "Jul" / "Aug" / "Sep" / "Oct" / "Nov" / "Dec "

day = ([FWS] 1 * 2DIGIT) / obs-day

time = time in FWS zone

time-of-day = hour ":" minute [":" second]

hour = 2DIGIT / total hour

minute = 2DIGIT / obs-minute

second = 2DIGIT / obs-second

zone = (("+" / "-") 4DIGIT) / obs-zone

+15
source

I think the reason is in the documentation. Date formats may be the same, but they are defined in different documents independently. And be honest

 const string COMMON_DATE_FORMAT_FOR_RFC1123_AND_2822 = "D, d MYH:i:s O" ; 

won't be as comfortable.

+1
source

Source: https://habr.com/ru/post/926124/


All Articles