Oihana PHP

isPast.php

Table of Contents

Functions

isPast()  : bool
Tells whether a date is strictly in the past.

Functions

isPast()

Tells whether a date is strictly in the past.

isPast(DateTimeInterface $date[, DateTimeInterface|null $now = null ]) : bool
Parameters
$date : DateTimeInterface

The date to test.

$now : DateTimeInterface|null = null

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

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

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

Marc Alcaraz (ekameleon)

since
1.0.9
Return values
bool

true if $date is strictly before $now, false otherwise.

On this page

Search results