Automattic\WooCommerce\Admin\API\Reports
TimeInterval::next_day_start()
Returns a new DateTime object representing the next day start, or previous day end if reversed.
Метод класса: TimeInterval{}
Хуков нет.
Возвращает
DateTime
.
Использование
$result = TimeInterval::next_day_start( $datetime, $reversed );
- $datetime(DateTime) (обязательный)
- Date and time.
- $reversed(true|false)
- Going backwards in time instead of forward.
По умолчанию: false
Код TimeInterval::next_day_start() TimeInterval::next day start WC 9.7.1
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; }