Date
extends DateTime
in package
implements
JsonSerializable, Stringable
Class Date.
Tags
Table of Contents
Interfaces
- JsonSerializable
- Stringable
Constants
- DATETIME : mixed = 'Y-m-d H:i:s'
Properties
Methods
- __construct() : mixed
- __toString() : string
- createFromFormat() : false|static
- Parse a string into a new static object according to the specified format.
- createFromImmutable() : static
- getLanguage() : Language
- humanize() : string
- jsonSerialize() : string
- setLanguage() : static
Constants
DATETIME
public
mixed
DATETIME
= 'Y-m-d H:i:s'
Properties
$language
protected
Language
$language
Methods
__construct()
public
final __construct([string $datetime = 'now' ][, DateTimeZone|null $timezone = null ][, Language|null $language = null ]) : mixed
Parameters
- $datetime : string = 'now'
- $timezone : DateTimeZone|null = null
- $language : Language|null = null
__toString()
public
__toString() : string
Return values
stringcreateFromFormat()
Parse a string into a new static object according to the specified format.
public
static createFromFormat(string $format, string $datetime[, DateTimeZone|null $timezone = null ]) : false|static
Parameters
- $format : string
-
Format accepted by date()
- $datetime : string
-
A string representing the time
- $timezone : DateTimeZone|null = null
-
A DateTimeZone object representing the desired time zone
Tags
Return values
false|staticcreateFromImmutable()
public
static createFromImmutable(DateTimeImmutable $object) : static
Parameters
- $object : DateTimeImmutable
Tags
Return values
staticgetLanguage()
public
getLanguage() : Language
Return values
Languagehumanize()
public
humanize() : string
Return values
stringjsonSerialize()
public
jsonSerialize() : string
Return values
stringsetLanguage()
public
setLanguage(Language $language) : static
Parameters
- $language : Language