* Returns the difference between two DateTime objects * @link https://secure.php.net/manual/en/datetime.diff.php * @param DateTimeInterface $targetObject
The date to compare to.
* @param bool $absoluteShould the interval be forced to be positive?
* @return DateInterval * The https://secure.php.net/manual/en/class.dateinterval.php DateInterval} object representing the * difference between the two dates. */ #[TentativeType] public function diff( DateTimeInterface $targetObject, #[LanguageLevelTypeAware(['8.0' => 'bool'], default: '')] $absolute = false ): DateInterval; /** * (PHP 5 >=5.5.0)* Format accepted by {@link https://secure.php.net/manual/en/function.date.php date()}. *
* @return string * Returns the formatted date string on success or FALSE on failure. * Since PHP8, it always returns STRING. */ #[TentativeType] public function format(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format): string; /** * (PHP 5 >=5.5.0)A date/time string. Valid formats are explained in {@link https://secure.php.net/manual/en/datetime.formats.php Date and Time Formats}.
*Enter NULL here to obtain the current time when using the $timezone parameter.
* @param null|DateTimeZone $timezone [optional]* A {@link https://secure.php.net/manual/en/class.datetimezone.php DateTimeZone} object representing the timezone of $datetime. *
*If $timezone is omitted, the current timezone will be used.
** @throws Exception Emits Exception in case of an error. */ public function __construct( #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $datetime = "now", #[LanguageLevelTypeAware(['8.0' => 'DateTimeZone|null'], default: 'DateTimeZone')] $timezone = null ) {} /** * (PHP 5 >=5.5.0)Note:
* The $timezone parameter and the current timezone are ignored when the $datetime parameter either * is a UNIX timestamp (e.g. @946684800) or specifies a timezone (e.g. 2010-01-28T15:00:00+02:00). *
A date/time string. Valid formats are explained in * {@link https://secure.php.net/manual/en/datetime.formats.php Date and Time Formats}.
* @return static|false Returns the newly created object or false on failure. * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or FALSE on failure. */ #[Pure] #[TentativeType] public function modify(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $modifier): DateTimeImmutable|false {} /** * (PHP 5 >=5.5.0)Initialization array.
* @return DateTimeImmutable * Returns a new instance of a {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object. */ public static function __set_state(array $array) {} /** * (PHP 5 >=5.5.0)Year of the date.
* @param int $monthMonth of the date.
* @param int $dayDay of the date.
* @return static|false * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or FALSE on failure. */ #[TentativeType] public function setDate( #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $year, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $month, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $day ): DateTimeImmutable {} /** * (PHP 5 >=5.5.0)Year of the date.
* @param int $weekWeek of the date.
* @param int $dayOfWeek [optional]Offset from the first day of the week.
* @return static|false * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or FALSE on failure. */ #[TentativeType] public function setISODate( #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $year, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $week, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $dayOfWeek = 1 ): DateTimeImmutable {} /** * (PHP 5 >=5.5.0)Hour of the time.
* @param int $minuteMinute of the time.
* @param int $second [optional]Second of the time.
* @param int $microsecond [optional]Microseconds of the time. Added since 7.1
* @return static|false * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or FALSE on failure. */ #[TentativeType] public function setTime( #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $hour, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $minute, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $second = 0, #[PhpStormStubsElementAvailable(from: '7.1')] #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $microsecond = 0 ): DateTimeImmutable {} /** * (PHP 5 >=5.5.0)Unix timestamp representing the date.
* @return static * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or FALSE on failure. */ #[TentativeType] public function setTimestamp(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $timestamp): DateTimeImmutable {} /** * (PHP 5 >=5.5.0)* A {@link https://secure.php.net/manual/en/class.datetimezone.php DateTimeZone} object representing the * desired time zone. *
* @return static * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or FALSE on failure. */ #[TentativeType] public function setTimezone(DateTimeZone $timezone): DateTimeImmutable {} /** * (PHP 5 >=5.5.0)* A {@link https://secure.php.net/manual/en/class.dateinterval.php DateInterval} object *
* @return static * Returns the {@link https://secure.php.net/manual/en/class.datetimeimmutable.php DateTimeImmutable} object for method chaining or FALSE on failure. */ #[TentativeType] public function sub(DateInterval $interval): DateTimeImmutable {} /** * (PHP 5 >=5.5.0)The date to compare to.
* @param bool $absolute [optional]Should the interval be forced to be positive?
* @return DateInterval|false * The {@link https://secure.php.net/manual/en/class.dateinterval.php DateInterval} object representing the * difference between the two dates or FALSE on failure. */ #[TentativeType] public function diff( #[LanguageLevelTypeAware(['8.0' => 'DateTimeInterface'], default: '')] $targetObject, #[LanguageLevelTypeAware(['8.0' => 'bool'], default: '')] $absolute = false ): DateInterval {} /** * (PHP 5 >=5.5.0)* Format accepted by {@link https://secure.php.net/manual/en/function.date.php date()}. *
* @return string * Returns the formatted date string on success or FALSE on failure. */ #[TentativeType] public function format(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format): string {} /** * (PHP 5 >=5.5.0)A date/time string. Valid formats are explained in {@link https://php.net/manual/en/datetime.formats.php Date and Time Formats}.
** Enter now here to obtain the current time when using * the $timezone parameter. *
* @param null|DateTimeZone $timezone [optional]* A {@link https://php.net/manual/en/class.datetimezone.php DateTimeZone} object representing the * timezone of $datetime. *
** If $timezone is omitted, * the current timezone will be used. *
** @throws Exception Emits Exception in case of an error. */ public function __construct( #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $datetime = 'now', #[LanguageLevelTypeAware(['8.0' => 'DateTimeZone|null'], default: 'DateTimeZone')] $timezone = null ) {} /** * @return void * @link https://php.net/manual/en/datetime.wakeup.php */ #[TentativeType] public function __wakeup(): void {} /** * Returns date formatted according to given format. * @param string $format * @return string * @link https://php.net/manual/en/datetime.format.php */ #[TentativeType] public function format(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format): string {} /** * Alter the timestamp of a DateTime object by incrementing or decrementing * in a format accepted by strtotime(). * @param string $modifier A date/time string. Valid formats are explained in Date and Time Formats. * @return static|false Returns the DateTime object for method chaining or FALSE on failure. * @link https://php.net/manual/en/datetime.modify.php */ #[TentativeType] public function modify(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $modifier): DateTime|false {} /** * Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object * @param DateInterval $interval * @return static * @link https://php.net/manual/en/datetime.add.php */ #[TentativeType] public function add(DateInterval $interval): DateTime {} /** * @param DateTimeImmutable $object * @return DateTime * @since 7.3 */ #[TentativeType] #[LanguageLevelTypeAware(['8.2' => 'static'], default: 'DateTime')] public static function createFromImmutable(DateTimeImmutable $object) {} /** * Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object * @param DateInterval $interval * @return static * @link https://php.net/manual/en/datetime.sub.php */ #[TentativeType] public function sub(DateInterval $interval): DateTime {} /** * Get the TimeZone associated with the DateTime * @return DateTimeZone|false * @link https://php.net/manual/en/datetime.gettimezone.php */ #[TentativeType] public function getTimezone(): DateTimeZone|false {} /** * Set the TimeZone associated with the DateTime * @param DateTimeZone $timezone * @return static * @link https://php.net/manual/en/datetime.settimezone.php */ #[TentativeType] public function setTimezone(#[LanguageLevelTypeAware(['8.0' => 'DateTimeZone'], default: '')] $timezone): DateTime {} /** * Returns the timezone offset * @return int * @link https://php.net/manual/en/datetime.getoffset.php */ #[TentativeType] public function getOffset(): int {} /** * Sets the current time of the DateTime object to a different time. * @param int $hour * @param int $minute * @param int $second * @param int $microsecond Added since 7.1 * @return static * @link https://php.net/manual/en/datetime.settime.php */ #[TentativeType] public function setTime( #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $hour, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $minute, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $second = 0, #[PhpStormStubsElementAvailable(from: '7.1')] #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $microsecond = 0 ): DateTime {} /** * Sets the current date of the DateTime object to a different date. * @param int $year * @param int $month * @param int $day * @return static * @link https://php.net/manual/en/datetime.setdate.php */ #[TentativeType] public function setDate( #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $year, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $month, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $day ): DateTime {} /** * Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates. * @param int $year * @param int $week * @param int $dayOfWeek * @return static * @link https://php.net/manual/en/datetime.setisodate.php */ #[TentativeType] public function setISODate( #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $year, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $week, #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $dayOfWeek = 1 ): DateTime {} /** * Sets the date and time based on a Unix timestamp. * @param int $timestamp * @return static * @link https://php.net/manual/en/datetime.settimestamp.php */ #[TentativeType] public function setTimestamp(#[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $timestamp): DateTime {} /** * Gets the Unix timestamp. * @return int * @link https://php.net/manual/en/datetime.gettimestamp.php */ #[TentativeType] public function getTimestamp(): int {} /** * Returns the difference between two DateTime objects represented as a DateInterval. * @param DateTimeInterface $targetObject The date to compare to. * @param bool $absolute [optional] Whether to return absolute difference. * @return DateInterval|false The DateInterval object representing the difference between the two dates. * @link https://php.net/manual/en/datetime.diff.php */ #[TentativeType] public function diff( #[LanguageLevelTypeAware(['8.0' => 'DateTimeInterface'], default: '')] $targetObject, #[LanguageLevelTypeAware(['8.0' => 'bool'], default: '')] $absolute = false ): DateInterval {} /** * Parse a string into a new DateTime object according to the specified format * @param string $format Format accepted by date(). * @param string $datetime String representing the time. * @param null|DateTimeZone $timezone A DateTimeZone object representing the desired time zone. * @return DateTime|false * @link https://php.net/manual/en/datetime.createfromformat.php */ #[TentativeType] public static function createFromFormat( #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $format, #[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $datetime, #[LanguageLevelTypeAware(['8.0' => 'DateTimeZone|null'], default: 'DateTimeZone')] $timezone = null ): DateTime|false {} /** * Returns an array of warnings and errors found while parsing a date/time string * @return array|false * @link https://php.net/manual/en/datetime.getlasterrors.php */ #[ArrayShape(["warning_count" => "int", "warnings" => "string[]", "error_count" => "int", "errors" => "string[]"])] #[TentativeType] public static function getLastErrors(): array|false {} /** * The __set_state handler * @link https://php.net/manual/en/datetime.set-state.php * @param array $arrayNote: *
* The $timezone parameter * and the current timezone are ignored when the * $time parameter either * is a UNIX timestamp (e.g. @946684800) * or specifies a timezone * (e.g. 2010-01-28T15:00:00+02:00). *
Initialization array.
* @return DateTimeReturns a new instance of a DateTime object.
*/ public static function __set_state($array) {} /** * @param DateTimeInterface $object * @return DateTime * @since 8.0 */ public static function createFromInterface(DateTimeInterface $object): DateTime {} #[PhpStormStubsElementAvailable(from: '8.2')] public function __serialize(): array {} #[PhpStormStubsElementAvailable(from: '8.2')] public function __unserialize(array $data): void {} } /** * Representation of time zone * @link https://php.net/manual/en/class.datetimezone.php */ class DateTimeZone { public const AFRICA = 1; public const AMERICA = 2; public const ANTARCTICA = 4; public const ARCTIC = 8; public const ASIA = 16; public const ATLANTIC = 32; public const AUSTRALIA = 64; public const EUROPE = 128; public const INDIAN = 256; public const PACIFIC = 512; public const UTC = 1024; public const ALL = 2047; public const ALL_WITH_BC = 4095; public const PER_COUNTRY = 4096; /** * @param string $timezone * @link https://php.net/manual/en/datetimezone.construct.php * @throws Exception Emits Exception in case of an error. */ public function __construct(#[LanguageLevelTypeAware(['8.0' => 'string'], default: '')] $timezone) {} /** * Returns the name of the timezone * @return string * @link https://php.net/manual/en/datetimezone.getname.php */ #[TentativeType] public function getName(): string {} /** * Returns location information for a timezone * @return array|false * @link https://php.net/manual/en/datetimezone.getlocation.php */ #[TentativeType] #[ArrayShape([ 'country_code' => 'string', 'latitude' => 'double', 'longitude' => 'double', 'comments' => 'string', ])] public function getLocation(): array|false {} /** * Returns the timezone offset from GMT * @param DateTimeInterface $datetime * @return int * @link https://php.net/manual/en/datetimezone.getoffset.php */ #[TentativeType] public function getOffset(DateTimeInterface $datetime): int {} /** * Returns all transitions for the timezone * @param int $timestampBegin * @param int $timestampEnd * @return array|false * @link https://php.net/manual/en/datetimezone.gettransitions.php */ #[TentativeType] public function getTransitions( #[PhpStormStubsElementAvailable(from: '5.3', to: '5.6')] $timestampBegin, #[PhpStormStubsElementAvailable(from: '5.3', to: '5.6')] $timestampEnd, #[PhpStormStubsElementAvailable(from: '7.0')] #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $timestampBegin = null, #[PhpStormStubsElementAvailable(from: '7.0')] #[LanguageLevelTypeAware(['8.0' => 'int'], default: '')] $timestampEnd = null ): array|false {} /** * Returns associative array containing dst, offset and the timezone name * @return array