DateTimeImmutable クラス

(PHP 5 >= 5.5.0, PHP 7)

はじめに

このクラスの挙動は DateTime とほぼ同じですが、 自分自身は変更せずに新しいオブジェクトを返すという点だけが異なります。

クラス概要

DateTimeImmutable implements DateTimeInterface {
/* メソッド */
public __construct ([ string $time = "now" [, DateTimeZone $timezone = NULL ]] )
public add ( DateInterval $interval ) : DateTimeImmutable
public static createFromFormat ( string $format , string $time [, DateTimeZone $timezone ] ) : DateTimeImmutable
public static createFromMutable ( DateTime $datetime ) : DateTimeImmutable
public static getLastErrors ( void ) : array
public modify ( string $modify ) : DateTimeImmutable
public static __set_state ( array $array ) : DateTimeImmutable
public setDate ( int $year , int $month , int $day ) : DateTimeImmutable
public setISODate ( int $year , int $week [, int $day = 1 ] ) : DateTimeImmutable
public setTime ( int $hour , int $minute [, int $second = 0 ] ) : DateTimeImmutable
public setTimestamp ( int $unixtimestamp ) : DateTimeImmutable
public sub ( DateInterval $interval ) : DateTimeImmutable
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 )
}

目次