Fork me on GitHub
Submit Search

DateTime::isWeekendDay()

Returns true if the given date time is a Saturday or Sunday.

FINAL   STATIC

isWeekendDay(\DateTime $dateTime) : boolean
Parameters
Name Type Description
$dateTime \DateTime The date/time object.
Return Value
boolean

DateTime::isWeekDay()

Returns true if the given date time is not a Saturday or Sunday.

FINAL   STATIC

isWeekDay(\DateTime $dateTime) : boolean
Parameters
Name Type Description
$dateTime \DateTime The date/time object.
Return Value
boolean

DateTime::isSameDay()

Returns true if the given dates occur on the same year, month and day.

FINAL   STATIC

isSameDay(\DateTime $thisDate, \DateTime $thatDate) : boolean
Parameters
Name Type Description
$thisDate \DateTime A date to compare.
$thatDate \DateTime A date to compare.
Return Value
boolean

DateTime::isDaylightSavings()

Indicates whether the given instance of DateTime is within the daylight saving time range for the current time zone.

FINAL   STATIC

isDaylightSavings(\DateTime $dateTime) : boolean
Parameters
Name Type Description
$dateTime \DateTime The date/time object.
Return Value
boolean

DateTime::isInRange()

Returns true if the given date is between the provided date range.

FINAL   STATIC

isInRange(
  \DateTime $subjectDate,
  \DateTime $startDate,
  \DateTime $endDate
) : boolean
Parameters
Name Type Description
$subjectDate \DateTime The date/time object being checked.
$startDate \DateTime The start date/time object.
$endDate \DateTime The end date/time object.
Return Value
boolean

Exceptions
\DomainException Thrown when an invalid date range is provided.

DateTime::asAgoString()

Returns the given DateTime instance as a "time ago" string.

FINAL   STATIC

asAgoString(\DateTime $dateTime) : string
Parameters
Name Type Description
$dateTime \DateTime The DateTime object to present as an ago string.
Return Value
string

Exceptions
\DomainException Thrown if the given $dateTime is in the future.

DateTimeZone::fromString()

Returns a \DateTimeZone instance for the give nameOrAbbreviation.

FINAL   STATIC

fromString(
  string $nameOrAbbreviation,
  \DateTimeZone $default = null
) : \DateTimeZone
Parameters
Name Type Description
$nameOrAbbreviation string The timezone nameOrAbbreviation.
$default \DateTimeZone The default timezone to return if none can be created.
Return Value
\DateTimeZone

DateTimeZone::fromOffset()

Returns a \DateTimeZone object based on gmt offset.

FINAL   STATIC

fromOffset(integer $gmtOffset, boolean $isDaylightSavings) : \DateTimeZone
Parameters
Name Type Description
$gmtOffset integer Offset from GMT in seconds.
$isDaylightSavings boolean Daylight saving time indicator.
Return Value
\DateTimeZone

Exceptions
\InvalidArgumentException Thrown if $gmtOffset is not an integer.
\InvalidArgumentException Thrown if $isDaylightSavings is not a boolean.

DateTimeZone::getLongName()

Returns the long name of the given \DateTimeZone.

FINAL   STATIC

getLongName(\DateTimeZone $timezone) : string
Parameters
Name Type Description
$timezone \DateTimeZone The timezone object from which the long name should be obtained.
Return Value
string