\app\framework\Component\StdLib\StdObject\DateTimeObjectManipulatorTrait

DateTimeObject manipulator trait.

Summary

Methods
Properties
Constants
add()
setDate()
setTime()
setTimestamp()
sub()
offsetToTimezone()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
parseDateInterval()
No private properties found
N/A

Methods

add()

add(string  $amount) : $this

Adds an amount of days, months, years, hours, minutes and seconds to a DateTimeObject.

Parameters

string $amount

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

Returns

$this

setDate()

setDate(integer  $year, integer  $month, integer  $day) : $this

Set the date on current object.

Parameters

integer $year
integer $month
integer $day

Returns

$this

setTime()

setTime(integer  $hour, integer  $minute, integer  $second) : $this

Set the time on current object.

Parameters

integer $hour
integer $minute
integer $second

Returns

$this

setTimestamp()

setTimestamp(integer  $timestamp) : $this

Set the timestamp on current object.

Parameters

integer $timestamp

UNIX timestamp.

Returns

$this

sub()

sub(string  $amount) : $this

Subtracts an amount of days, months, years, hours, minutes and seconds from current DateTimeObject.

Parameters

string $amount

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

Returns

$this

offsetToTimezone()

offsetToTimezone(string|\DateTimeZone  $timezone) : $this

Offsets the date object from current timezone to defined $timezone.

This is an alias of DateTimeObject::setTimezone.

Parameters

string|\DateTimeZone $timezone

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

Returns

$this

parseDateInterval()

parseDateInterval(  $interval) : \DateInterval

Parameters

$interval

Returns

\DateInterval