Dates
extends PlatformUtility
in package
Provides access to date utility functions.
Tags
Table of Contents
- ISO_8601_DATE_FORMAT = 'c'
- after() : bool
- Check if date is after another date
- before() : bool
- Check if date is before another date
- format() : string
- Format date using the locale for the current session.
- formatAsISO8601() : string
- Format date as ISO8601 string.
- now() : DateTime
- Return the current time.
Constants
ISO_8601_DATE_FORMAT
public
mixed
ISO_8601_DATE_FORMAT
= 'c'
Tags
Methods
after()
Check if date is after another date
public
after(DateTime|string|int $date, DateTime|string|int $target) :
bool
This function will try to create a DateTime object from the supplied date arguments.
Parameters
- $date : DateTime|string|int
- $target : DateTime|string|int
-
default to now
Tags
Return values
bool —before()
Check if date is before another date
public
before(DateTime|string|int $date, DateTime|string|int $target) :
bool
This function will try to create a DateTime object from the supplied date arguments.
Parameters
- $date : DateTime|string|int
- $target : DateTime|string|int
-
default to now
Tags
Return values
bool —format()
Format date using the locale for the current session.
public
format(DateTime|string|int $date, string|null $dateType, string|null $timeType[, bool $relative = false ][, string|null $locale = null ]) :
string
This function will try to create a DateTime object from the supplied date argument.
Parameters
- $date : DateTime|string|int
- $dateType : string|null
- $timeType : string|null
- $relative : bool = false
- $locale : string|null = null
Tags
Return values
string —formatAsISO8601()
Format date as ISO8601 string.
public
formatAsISO8601(DateTime|string|int $date) :
string
This function will try to create a DateTime object from the supplied date argument.
Parameters
- $date : DateTime|string|int
Tags
Return values
string —now()
Return the current time.
public
now() : DateTime