WordPress at Your Fingertips
function is not described

ActionScheduler_ListTable::get_schedule_display_string() protected WC 1.0

Get the scheduled date in a human friendly format.

{} It's a method of the class: ActionScheduler_ListTable{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_schedule_display_string( $schedule );
$schedule(ActionScheduler_Schedule) (required)
-

Code of ActionScheduler_ListTable::get_schedule_display_string() WC 6.1.1

protected function get_schedule_display_string( ActionScheduler_Schedule $schedule ) {

	$schedule_display_string = '';

	if ( ! $schedule->get_date() ) {
		return '0000-00-00 00:00:00';
	}

	$next_timestamp = $schedule->get_date()->getTimestamp();

	$schedule_display_string .= $schedule->get_date()->format( 'Y-m-d H:i:s O' );
	$schedule_display_string .= '<br/>';

	if ( gmdate( 'U' ) > $next_timestamp ) {
		/* translators: %s: date interval */
		$schedule_display_string .= sprintf( __( ' (%s ago)', 'woocommerce' ), self::human_interval( gmdate( 'U' ) - $next_timestamp ) );
	} else {
		/* translators: %s: date interval */
		$schedule_display_string .= sprintf( __( ' (%s)', 'woocommerce' ), self::human_interval( $next_timestamp - gmdate( 'U' ) ) );
	}

	return $schedule_display_string;
}