php - PHP 中的 RFC1123 和 RFC2822 日期时间格式有什么区别?

标签 php datetime rfc2822 rfc1123

这是出于好奇,而不是因为此时我需要了解它,但在 PHP 手册中,它们是相同的;我看不出为什么同一件事有两种不同的数据格式。

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

const string RFC1123 = "D, d M Y H:i:s O" ;
const string RFC2822 = "D, d M Y H:i:s O" ;

有什么线索吗?

最佳答案

RFC1123 是“Internet 主机的要求 - 应用和支持”,1989 年 10 月

RFC2822 是“Internet 消息格式”,2001 年 4 月

RFC1123 视为 RFC2822 的父级。它引用 RFC2822 作为日期/时间的适当规范,如下所示:

3.3. Date and Time Specification

Date and time occur in several header fields. This section specifies the syntax for a full date and time specification. Though folding white space is permitted throughout the date-time specification, it is RECOMMENDED that a single space be used in each place that FWS appears (whether it is required or optional); some older implementations may not interpret other occurrences of folding white space correctly.

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

day-of-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-of-day FWS zone

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

hour = 2DIGIT / obs-hour

minute = 2DIGIT / obs-minute

second = 2DIGIT / obs-second

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

关于php - PHP 中的 RFC1123 和 RFC2822 日期时间格式有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12569141/

相关文章:

c# - 在 .NET 中序列化 MailMessage 对象的优雅方式

java - 如何使用 javax.mail 将消息作为附件添加到另一条消息上

javascript - 从使用 jQuery 的 php 网站提取数据。无相关来源信息

php - 如何在 Nginx 的重写规则中包含所有的 php 文件?

java DateFormat 给出奇怪的格式结果

c# - 将相对日期时间字符串转换为 DateTime 对象

python - 将字符串转换为日期时间对象

php - 如何加快我网站上的图像加载时间?

php - opencart 中的 URL 重写

Oracle TIMESTAMP WITH TIMEZONE 命名区域与偏移量