DateTimeFactory

final readonly class \TYPO3\CMS\Core\Domain\DateTimeFactory

Table of Contents

Methods

createFromDatabaseValue()  : DateTimeImmutable|null
createFromDatabaseValueAndTCAConfig()  : DateTimeImmutable|null
createFromTimestamp()  : DateTimeImmutable
Create a DateTimeImmutable object from a unix timestamp in server localtime
getFormatFromTCAConfig()  : string

Methods

createFromDatabaseValue()

public static createFromDatabaseValue(int|string|null $value, DateTimeFieldType $fieldInformation) : DateTimeImmutable|null

Parameters

$value : int|string|null
$fieldInformation : DateTimeFieldType

Return values

DateTimeImmutable|null

createFromDatabaseValueAndTCAConfig()

public static createFromDatabaseValueAndTCAConfig(int|string|null $value, array $fieldConfig) : DateTimeImmutable|null

Parameters

$value : int|string|null
$fieldConfig : array

Return values

DateTimeImmutable|null

createFromTimestamp()

Create a DateTimeImmutable object from a unix timestamp in server localtime

public static createFromTimestamp(int $timestamp) : DateTimeImmutable

Alternative to \DateTimeImmutable('@…') which forces UTC timezone

Parameters

$timestamp : int

Return values

DateTimeImmutable

getFormatFromTCAConfig()

public static getFormatFromTCAConfig(array $fieldConfig) : string

Parameters

$fieldConfig : array

Return values

string
On this page