PHP Трейт Webiny\Component\StdLib\StdObject\DateTimeObject\ManipulatorTrait

Наследование: use trait Webiny\Component\StdLib\StdObject\StdObjectManipulatorTrait
Показать файл Открыть проект

Открытые методы

Метод Описание
add ( string $amount ) Adds an amount of days, months, years, hours, minutes and seconds to a DateTimeObject.
offsetToTimezone ( string | DateTimeZone $timezone ) Offsets the date object from current timezone to defined $timezone.
setDate ( integer $year, integer $month, integer $day ) Set the date on current object.
setTime ( integer $hour, integer $minute, integer $second ) Set the time on current object.
setTimestamp ( integer $timestamp ) Set the timestamp on current object.
sub ( string $amount ) Subtracts an amount of days, months, years, hours, minutes and seconds from current DateTimeObject.

Приватные методы

Метод Описание
parseDateInterval ( $interval ) : DateInterval

Описание методов

add() публичный Метод

Adds an amount of days, months, years, hours, minutes and seconds to a DateTimeObject.
public add ( string $amount )
$amount string You can specify the amount in ISO8601 format (example: 'P14D' = 14 days; 'P1DT12H' = 1 day 12 hours), or as a date string (example: '1 day', '2 months', '3 year', '2 days + 10 minutes').

offsetToTimezone() публичный Метод

This is an alias of DateTimeObject::setTimezone.
public offsetToTimezone ( string | DateTimeZone $timezone )
$timezone string | DateTimeZone Timezone to which you wish to offset. You can either pass \DateTimeZone object or a valid timezone string. For timezone string formats visit: http://php.net/manual/en/timezones.php

setDate() публичный Метод

Set the date on current object.
public setDate ( integer $year, integer $month, integer $day )
$year integer
$month integer
$day integer

setTime() публичный Метод

Set the time on current object.
public setTime ( integer $hour, integer $minute, integer $second )
$hour integer
$minute integer
$second integer

setTimestamp() публичный Метод

Set the timestamp on current object.
public setTimestamp ( integer $timestamp )
$timestamp integer UNIX timestamp.

sub() публичный Метод

Subtracts an amount of days, months, years, hours, minutes and seconds from current DateTimeObject.
public sub ( string $amount )
$amount string You can specify the amount in ISO8601 format (example: 'P14D' = 14 days; 'P1DT12H' = 1 day 12 hours), or as a date string (example: '1 day', '2 months', '3 year', '2 days + 10 minutes').