PHP Trait Webiny\Component\StdLib\StdObject\DateTimeObject\ManipulatorTrait

Inheritance: use trait Webiny\Component\StdLib\StdObject\StdObjectManipulatorTrait
ファイルを表示 Open project: Webiny/Framework

Public Methods

Method Description
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.

Private Methods

Method Description
parseDateInterval ( $interval ) : DateInterval

Method Details

add() public method

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() public method

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() public method

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

setTime() public method

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

setTimestamp() public method

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

sub() public method

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').