Oihana PHP

isToday.php

Table of Contents

Functions

isToday()  : bool
Tells whether a date falls on the current calendar day.

Functions

isToday()

Tells whether a date falls on the current calendar day.

isToday(DateTimeInterface $date[, DateTimeInterface|null $now = null ][, DateTimeZone|null $timezone = null ]) : bool

A special case of isSameDay( $date , $now ) — see there for the timezone rule : the comparison is made in $timezone, defaulting to the timezone carried by $date.

Parameters
$date : DateTimeInterface

The date to test.

$now : DateTimeInterface|null = null

The reference "now". Defaults to the current date/time.

$timezone : DateTimeZone|null = null

The timezone the comparison is made in. Defaults to $date's own timezone.

Tags
example
use function oihana\core\date\isToday;

isToday( new DateTimeImmutable() ) ; // true
isToday( new DateTimeImmutable( '2000-01-01' ) ) ; // false
author

Marc Alcaraz (ekameleon)

since
1.2.0
Return values
bool

true if $date falls on the same calendar day as $now, false otherwise.

On this page

Search results