DateTime
class DateTime extends DateTime implements JsonSerializable
DateTime.
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
Creates a DateTime object from a string, UNIX timestamp, or other DateTimeInterface object.
Creates DateTime object.
Returns new DateTime object formatted according to the specified format.
Returns JSON representation in ISO 8601 (used by JavaScript).
Returns the date and time in the format 'Y-m-d H:i:s'.
You'd better use: (clone $dt)->modify(...)
Details
at line 45
static DateTime
from(string|int|DateTimeInterface|null $time)
Creates a DateTime object from a string, UNIX timestamp, or other DateTimeInterface object.
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.
at line 96
static static|false
createFromFormat(string $format, string $time, string|DateTimeZone|null $timezone = null)
Returns new DateTime object formatted according to the specified format.
at line 117
string
jsonSerialize()
Returns JSON representation in ISO 8601 (used by JavaScript).
at line 126
string
__toString()
Returns the date and time in the format 'Y-m-d H:i:s'.
at line 135
DateTime
modifyClone(string $modify = '')
You'd better use: (clone $dt)->modify(...)
Traits
Strict class for better experience.