Nextcloud PHP API (master)

ITimeFactory extends ClockInterface

Use this to get a timestamp or DateTime object in code to remain testable

Tags
since
8.0.0
since
27.0.0

Extends the \Psr\Clock\ClockInterface interface

ref

https://www.php-fig.org/psr/psr-20/#21-clockinterface

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
since
15.0.0
Return values
DateTime

getTime()

public getTime() : int
Tags
since
8.0.0
Return values
int

the result of a call to time()

getTimeZone()

public getTimeZone([string|null $timezone = null ]) : DateTimeZone
Parameters
$timezone : string|null = null
Tags
throws
Exception
since
29.0.0
Return values
DateTimeZone

Requested timezone if provided, UTC otherwise

withTimeZone()

public withTimeZone(DateTimeZone $timezone) : static
Parameters
$timezone : DateTimeZone
Tags
since
26.0.0
Return values
static

        
On this page

Search results