Date class
Framework\Date\Date
Class Date.
Extends DateTime
Implements:
DateTimeInterface, JsonSerializable, Stringable
Defined in libraries/date/src/Date.php
Constants #
- DATETIME
- -
Properties #
$language
protected \Framework\Language\Language $language
Methods #
- __construct()
- -
- __toString()
- -
- createFromFormat()
- Parse a string into a new static object according to the specified format.
- createFromImmutable()
- -
- getLanguage()
- -
- humanize()
- -
- jsonSerialize()
- -
- setLanguage()
- -
__construct()
public final function __construct(string $datetime = 'now', ?DateTimeZone $timezone = NULL, ?\Framework\Language\Language $language = NULL)
Parameters
- string $datetime
- ?DateTimeZone $timezone
- ?\Framework\Language\Language $language
__toString()
public function __toString(): string
Returns
string
createFromFormat()
public static function createFromFormat(string $format, string $datetime, ?DateTimeZone $timezone = NULL): static|false
Parse a string into a new static object according to the specified format.
Parameters
- string $format - Format accepted by date()
- string $datetime - A string representing the time
- ?DateTimeZone $timezone - A DateTimeZone object representing the desired time zone
Returns
static|false
createFromImmutable()
public static function createFromImmutable(DateTimeImmutable $object): static
Parameters
- DateTimeImmutable $object
Returns
static
getLanguage()
public function getLanguage(): \Framework\Language\Language
Returns
\Framework\Language\Language
humanize()
public function humanize(): string
Returns
string
jsonSerialize()
public function jsonSerialize(): string
Returns
string
setLanguage()
public function setLanguage(\Framework\Language\Language $language): static
Parameters
- \Framework\Language\Language $language
Returns
static
Inherited methods #
-
__serialize()fromDateTime -
__unserialize()fromDateTime -
__wakeup()fromDateTime -
__set_state()fromDateTime -
createFromInterface()fromDateTime -
createFromTimestamp()fromDateTime -
getLastErrors()fromDateTime -
format()fromDateTime -
modify()fromDateTime -
add()fromDateTime -
sub()fromDateTime -
getTimezone()fromDateTime -
setTimezone()fromDateTime -
getOffset()fromDateTime -
getMicrosecond()fromDateTime -
setTime()fromDateTime -
setDate()fromDateTime -
setISODate()fromDateTime -
setTimestamp()fromDateTime -
setMicrosecond()fromDateTime -
getTimestamp()fromDateTime -
diff()fromDateTime