Oihana PHP

startOfDay.php

Table of Contents

Functions

startOfDay()  : DateTimeImmutable
Returns the first representable instant of the day containing a date.

Functions

startOfDay()

Returns the first representable instant of the day containing a date.

startOfDay(DateTimeInterface $date) : DateTimeImmutable

A new DateTimeImmutable is returned, its date unchanged and its time set to 00:00:00.000000 ; the source date is never modified. The timezone of the returned value is the one carried by $date.

Parameters
$date : DateTimeInterface

The source date.

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

startOfDay( new DateTimeImmutable( '2026-03-15 14:30:45' ) ) ; // 2026-03-15 00:00:00.000000
author

Marc Alcaraz (ekameleon)

since
1.2.0
Return values
DateTimeImmutable

A new immutable date, at the start of the same day.

On this page

Search results