DateTime 锟斤拷

(PHP 5 >= 5.2.0, PHP 7)

锟斤拷锟�

锟斤拷锟节猴拷时锟戒。

锟斤拷摘要

DateTime implements DateTimeInterface {
/* Inherited constants */
const string DateTimeInterface::ATOM = "Y-m-d\TH:i:sP" ;
const string DateTimeInterface::COOKIE = "l, d-M-Y H:i:s T" ;
const string DateTimeInterface::ISO8601 = "Y-m-d\TH:i:sO" ;
const string DateTimeInterface::RFC822 = "D, d M y H:i:s O" ;
const string DateTimeInterface::RFC850 = "l, d-M-y H:i:s T" ;
const string DateTimeInterface::RFC1036 = "D, d M y H:i:s O" ;
const string DateTimeInterface::RFC1123 = "D, d M Y H:i:s O" ;
const string DateTimeInterface::RFC2822 = "D, d M Y H:i:s O" ;
const string DateTimeInterface::RFC3339 = "Y-m-d\TH:i:sP" ;
const string DateTimeInterface::RFC3339_EXTENDED = "Y-m-d\TH:i:s.vP" ;
const string DateTimeInterface::RSS = "D, d M Y H:i:s O" ;
const string DateTimeInterface::W3C = "Y-m-d\TH:i:sP" ;
/* 锟斤拷锟斤拷 */
public __construct ([ string $time = "now" [, DateTimeZone $timezone = NULL ]] )
public add ( DateInterval $interval ) : DateTime
public static createFromFormat ( string $format , string $time [, DateTimeZone $timezone ] ) : DateTime
public static getLastErrors ( void ) : array
public modify ( string $modify ) : DateTime
public static __set_state ( array $array ) : DateTime
public setDate ( int $year , int $month , int $day ) : DateTime
public setISODate ( int $year , int $week [, int $day = 1 ] ) : DateTime
public setTime ( int $hour , int $minute [, int $second = 0 [, int $microseconds = 0 ]] ) : DateTime
public setTimestamp ( int $unixtimestamp ) : DateTime
public setTimezone ( DateTimeZone $timezone ) : DateTime
public sub ( DateInterval $interval ) : DateTime
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 )
}

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
7.2.0 DateTime 锟斤拷锟洁常锟斤拷锟斤拷锟节讹拷锟斤拷锟斤拷 DateTimeInterface 锟较★拷
7.0.0 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷DATE_RFC3339_EXTENDED 锟斤拷 DateTime::RFC3339_EXTENDED锟斤拷
5.5.0 实锟斤拷 DateTimeInterface 锟接口★拷
5.4.24 COOKIE 锟斤拷式锟斤拷 2 位锟斤拷锟街憋拷示锟斤拷荩锟絉FC 850锟斤拷 锟睫革拷为 4 位锟斤拷锟街憋拷示锟斤拷荩锟絉FC 1036锟斤拷锟斤拷
5.2.2 DateTime 锟斤拷锟斤拷锟斤拷斜冉喜锟斤拷锟斤拷锟�comparison operators锟斤拷锟斤拷时锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟剿★拷 锟斤拷之前锟侥版本锟叫o拷锟斤拷使锟斤拷 == 锟斤拷锟斤拷锟斤拷缺冉系锟绞憋拷锟� 锟斤拷锟叫碉拷 DateTime 锟斤拷锟襟都会被锟斤拷为锟斤拷锟斤拷鹊摹锟�

Table of Contents

  • DateTime::add — 锟斤拷一锟斤拷 DateTime 锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟届,锟铰o拷锟疥,小时锟斤拷锟斤拷锟斤拷 锟皆硷拷锟诫。
  • DateTime::__construct — 锟斤拷锟斤拷一锟斤拷锟铰碉拷 DateTime 锟斤拷锟斤拷
  • DateTime::createFromFormat — 锟斤拷锟捷革拷锟斤拷锟侥革拷式锟斤拷锟斤拷锟斤拷锟斤拷时锟斤拷锟街凤拷锟斤拷
  • DateTime::getLastErrors — 锟斤拷取锟斤拷锟斤拷痛锟斤拷锟斤拷锟较�
  • DateTime::modify — 锟睫革拷锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷值
  • DateTime::__set_state — __set_state 魔锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
  • DateTime::setDate — 锟斤拷锟斤拷 DateTime 锟斤拷锟斤拷锟斤拷锟斤拷锟�
  • DateTime::setISODate — 锟斤拷锟斤拷 ISO 锟斤拷锟斤拷
  • DateTime::setTime — 锟斤拷锟斤拷 DateTime 锟斤拷锟斤拷锟绞憋拷锟�
  • DateTime::setTimestamp — 锟斤拷 Unix 时锟斤拷锟斤拷姆锟绞斤拷锟斤拷锟� DateTime 锟斤拷锟斤拷
  • DateTime::setTimezone — 锟斤拷锟斤拷 DateTime 锟斤拷锟斤拷锟绞憋拷锟�
  • DateTime::sub — 锟斤拷一锟斤拷 DateTime 锟斤拷锟斤拷锟饺ヒ伙拷锟斤拷锟斤拷锟� 锟秸★拷锟铰★拷锟疥、小时锟斤拷锟斤拷锟接猴拷锟诫。