Oihana PHP

subMinutes.php

Table of Contents

Functions

subMinutes()  : DateTimeImmutable
Returns a copy of a date shifted backwards by a number of minutes.

Functions

subMinutes()

Returns a copy of a date shifted backwards by a number of minutes.

subMinutes(DateTimeInterface $date, int $minutes) : DateTimeImmutable

A new DateTimeImmutable is returned ; the source date is never modified. Equivalent to addMinutes( $date , -$minutes ) — see addMinutes() for the elapsed-time semantics across a DST transition.

Parameters
$date : DateTimeInterface

The source date.

$minutes : int

The number of minutes to subtract.

Tags
throws
DateMalformedStringException

Never thrown in practice (the modifier is always well-formed).

example
use function oihana\core\date\subMinutes;

subMinutes( new DateTimeImmutable( '2026-01-01 01:30:00' ) , 90 ) ; // 2026-01-01 00:00:00
author

Marc Alcaraz (ekameleon)

since
1.2.0
Return values
DateTimeImmutable

A new immutable date shifted backwards by $minutes minutes.

On this page

Search results