Automattic\WooCommerce\Admin\API\Reports

TimeInterval::next_day_start()public staticWC 1.0

Returns a new DateTime object representing the next day start, or previous day end if reversed.

Method of the class: TimeInterval{}

No Hooks.

Return

DateTime.

Usage

$result = TimeInterval::next_day_start( $datetime, $reversed );
$datetime(DateTime) (required)
Date and time.
$reversed(true|false)
Going backwards in time instead of forward.
Default: false

TimeInterval::next_day_start() code WC 7.3.0

public static function next_day_start( $datetime, $reversed = false ) {
	$oneday       = new \DateInterval( 'P1D' );
	$new_datetime = clone $datetime;

	if ( $reversed ) {
		$new_datetime->sub( $oneday );
		$new_datetime->setTime( 23, 59, 59 );
	} else {
		$new_datetime->add( $oneday );
		$new_datetime->setTime( 0, 0, 0 );
	}

	return $new_datetime;
}