The DateTimeInterface interface

(PHP 5 >= 5.5.0, PHP 7)

���

DateTimeInterface ����˼�ǿ���Լ������Ϊ DateTime �� DateTimeImmutable���˽ӿڲ������û��Լ��� class ȥʵ�֣�implements����

��ժҪ

DateTimeInterface {
/* ���� */
const string ATOM = "Y-m-d\TH:i:sP" ;
const string COOKIE = "l, d-M-Y H:i:s T" ;
const string ISO8601 = "Y-m-d\TH:i:sO" ;
const string RFC822 = "D, d M y H:i:s O" ;
const string RFC850 = "l, d-M-y H:i:s T" ;
const string RFC1036 = "D, d M y H:i:s O" ;
const string RFC1123 = "D, d M Y H:i:s O" ;
const string RFC2822 = "D, d M Y H:i:s O" ;
const string RFC3339 = "Y-m-d\TH:i:sP" ;
const string RFC3339_EXTENDED = "Y-m-d\TH:i:s.vP" ;
const string RSS = "D, d M Y H:i:s O" ;
const string W3C = "Y-m-d\TH:i:sP" ;
/* ���� */
public diff ( DateTimeInterface $datetime2 [, bool $absolute = FALSE ] ) : DateInterval
public format ( string $format ) : string
public getOffset ( void ) : int
public getTimestamp ( void ) : int
public getTimezone ( void ) : DateTimeZone
public __wakeup ( void )
}

Ԥ���峣��

DateTimeInterface::ATOM
DATE_ATOM
Atom ��ʽ ��ʾ����2005-08-15T15:52:01+00:00��
DateTimeInterface::COOKIE
DATE_COOKIE
HTTP Cookies ��ʽ ��ʾ����Monday, 15-Aug-2005 15:52:01 UTC��
DateTimeInterface::ISO8601
DATE_ISO8601
ISO-8601 ��ʽ��ʾ����2005-08-15T15:52:01+0000��

Note: ���ָ�ʽ�� ISO-8601 �ĸ�ʽ�������ݣ�ֻ�dz��������ݵ�ԭ��ű����ġ� ���Ҫʹ�ú� ISO-8601 ���ݵĸ�ʽ�� ��ʹ�� DateTime::ATOM �� DATE_ATOM ����������

DateTimeInterface::RFC822
DATE_RFC822
RFC 822 ��ʽ ��ʾ����Mon, 15 Aug 05 15:52:01 +0000��
DateTimeInterface::RFC850
DATE_RFC850
RFC 850 ��ʽ ��ʾ����Monday, 15-Aug-05 15:52:01 UTC��
DateTimeInterface::RFC1036
DATE_RFC1036
RFC 1036 (ʾ���� Mon, 15 Aug 05 15:52:01 +0000)
DateTimeInterface::RFC1123
DATE_RFC1123
RFC 1123 ��ʽ ��ʾ����Mon, 15 Aug 2005 15:52:01 +0000��
DateTimeInterface::RFC2822
DATE_RFC2822
RFC 2822 ��ʽ ��ʾ����Mon, 15 Aug 2005 15:52:01 +0000��
DateTimeInterface::RFC3339
DATE_RFC3339
ͬ DATE_ATOM ���� PHP 5.1.3 �汾���ã�
DateTimeInterface::RFC3339_EXTENDED
DATE_RFC3339_EXTENDED
RFC 3339 EXTENDED ��ʽ ���� PHP 7.0.0 ���ã���ʾ����2005-08-15T15:52:01.000+00:00��
DateTimeInterface::RSS
DATE_RSS
RSS (example: Mon, 15 Aug 2005 15:52:01 +0000)
DateTimeInterface::W3C
DATE_W3C
RSS ��ʽ ��ʾ����Mon, 15 Aug 2005 15:52:01 +0000��

������־

�汾 ˵��
7.2.0 DateTime ���ೣ�����ڶ������� DateTimeInterface �ϡ�
5.5.8 ����ʵ�֣�implement��DateTimeInterface ʱ�����׳����ش��� ֮ǰ�˾ٲ���������󣬵����������Dz��Եġ�

Table of Contents