Automattic\WooCommerce\Admin\API

AnalyticsImports::get_next_scheduled_timeprivateWC 1.0

Get the next scheduled time for the batch processor.

Method of the class: AnalyticsImports{}

No Hooks.

Returns

String|null. Datetime string in site timezone or null if not scheduled.

Usage

// private - for code of main (parent) class only
$result = $this->get_next_scheduled_time();

AnalyticsImports::get_next_scheduled_time() code WC 10.5.0

private function get_next_scheduled_time() {
	$action_hook = OrdersScheduler::get_action( OrdersScheduler::PROCESS_PENDING_ORDERS_BATCH_ACTION );
	if ( ! is_string( $action_hook ) ) {
		return null;
	}
	$next_time = WC()->queue()->get_next( $action_hook, array(), (string) OrdersScheduler::$group );

	if ( ! $next_time ) {
		return null;
	}

	// Convert UTC timestamp to site timezone.
	return get_date_from_gmt( $next_time->format( 'Y-m-d H:i:s' ), 'Y-m-d H:i:s' );
}