ITimeFactory
extends
ClockInterface
in
Use this to get a timestamp or DateTime object in code to remain testable
Tags
Table of Contents
Methods
- getDateTime() : DateTime
- getTime() : int
- getTimeZone() : DateTimeZone
- withTimeZone() : static
Methods
getDateTime()
public
getDateTime([string $time = 'now' ][, DateTimeZone|null $timezone = null ]) : DateTime
Parameters
- $time : string = 'now'
- $timezone : DateTimeZone|null = null
Tags
Return values
DateTimegetTime()
public
getTime() : int
Tags
Return values
int —the result of a call to time()
getTimeZone()
public
getTimeZone([string|null $timezone = null ]) : DateTimeZone
Parameters
- $timezone : string|null = null
Tags
Return values
DateTimeZone —Requested timezone if provided, UTC otherwise
withTimeZone()
public
withTimeZone(DateTimeZone $timezone) : static
Parameters
- $timezone : DateTimeZone