DateTimeImmutable (class)

The DateTimeImmutable class

Introduction

(PHP 5 >= 5.5.0, PHP 7)

This class behaves the same as DateTime except it never modifies itself but returns a new object instead.

Class synopsis

DateTimeImmutable implements DateTimeInterface {
/* Methods */
public __construct ([ string $time = "now" [, DateTimeZone $timezone = NULL ]] )
public DateTimeImmutable add ( DateInterval $interval )
public static DateTimeImmutable createFromFormat ( string $format , string $time [, DateTimeZone $timezone ] )
public static DateTimeImmutable createFromMutable ( DateTime $datetime )
public static array getLastErrors ( void )
public DateTimeImmutable modify ( string $modify )
public static DateTimeImmutable __set_state ( array $array )
public DateTimeImmutable setDate ( int $year , int $month , int $day )
public DateTimeImmutable setISODate ( int $year , int $week [, int $day = 1 ] )
public DateTimeImmutable setTime ( int $hour , int $minute [, int $second = 0 ] )
public DateTimeImmutable setTimestamp ( int $unixtimestamp )
public DateTimeImmutable setTimezone ( DateTimeZone $timezone )
public DateTimeImmutable sub ( DateInterval $interval )
public DateInterval diff ( DateTimeInterface $datetime2 [, bool $absolute = false ] )
public string format ( string $format )
public int getOffset ( void )
public int getTimestamp ( void )
public DateTimeZone getTimezone ( void )
public __wakeup ( void )
}

Table of Contents

© 1997–2017 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://secure.php.net/manual/en/class.datetimeimmutable.php

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部