class DateTime extends DateTime implements JsonSerializable

DateTime.

Traits

Strict class for better experience.

Constants

MINUTE

minute in seconds

HOUR

hour in seconds

DAY

day in seconds

WEEK

week in seconds

MONTH

average month in seconds

YEAR

average year in seconds

Methods

static DateTime
from(string|int|DateTimeInterface $time)

DateTime object factory.

static DateTime
fromParts(int $year, int $month, int $day, int $hour = 0, int $minute = 0, float $second = 0.0)

Creates DateTime object.

static DateTime|false
createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null)

Returns new DateTime object formatted according to the specified format.

string
jsonSerialize()

Returns JSON representation in ISO 8601 (used by JavaScript).

string
__toString()

No description

modifyClone(string $modify = '')

No description

Details

at line 46
static DateTime from(string|int|DateTimeInterface $time)

DateTime object factory.

Parameters

string|int|DateTimeInterface $time

Return Value

DateTime

at line 67
static DateTime fromParts(int $year, int $month, int $day, int $hour = 0, int $minute = 0, float $second = 0.0)

Creates DateTime object.

Parameters

int $year
int $month
int $day
int $hour
int $minute
float $second

Return Value

DateTime

at line 84
static DateTime|false createFromFormat(string $format, string $time, string|DateTimeZone $timezone = null)

Returns new DateTime object formatted according to the specified format.

Parameters

string $format The format the $time parameter should be in
string $time
string|DateTimeZone $timezone (default timezone is used if null is passed)

Return Value

DateTime|false

at line 104
string jsonSerialize()

Returns JSON representation in ISO 8601 (used by JavaScript).

Return Value

string

at line 110
string __toString()

Return Value

string

at line 119
DateTime modifyClone(string $modify = '')

Parameters

string $modify

Return Value

DateTime