FrozenClock

Class
implements ClockInterface
Read only: Yes Final: Yes

Provides the current system time in a predictable timezone.

Table of Contents

Interfaces

Properties

 : DateTimeImmutable

Methods

__construct()

Creates a new frozen clock.

 : mixed
now()

Returns the current date-time.

 : DateTimeImmutable
 : DateTimeImmutable
Properties
Methods

__construct()

Public

Creates a new frozen clock.

public __construct([DateTimeInterface|ClockInterface|string|int|float  $clock = 'now']) : mixed
Parameters
$clock : DateTimeInterface|ClockInterface|string|int|float = 'now'

Description

the time to freeze, or a ClockInterface to use its current time

now()

Public

Returns the current date-time.

public now() : DateTimeImmutable
Return values
DateTimeImmutable

fromTimestamp()

Private
private fromTimestamp( float|int  $timestamp) : DateTimeImmutable
Parameters
$timestamp : float|int
Tags
throws
InvalidArgumentException
Return values
DateTimeImmutable