ActionScheduler_wcSystemStatus::get_action_status_date()
Get oldest or newest scheduled date for a given status.
Method of the class: ActionScheduler_wcSystemStatus{}
No Hooks.
Return
DateTime
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_action_status_date( $status, $date_type );
- $status(string) (required)
- Action status label/name string.
- $date_type(string)
- Oldest or Newest.
Default: 'oldest'
ActionScheduler_wcSystemStatus::get_action_status_date() ActionScheduler wcSystemStatus::get action status date code WC 9.3.3
protected function get_action_status_date( $status, $date_type = 'oldest' ) { $order = 'oldest' === $date_type ? 'ASC' : 'DESC'; $action = $this->store->query_actions( array( 'claimed' => false, 'status' => $status, 'per_page' => 1, 'order' => $order, ) ); if ( ! empty( $action ) ) { $date_object = $this->store->get_date( $action[0] ); $action_date = $date_object->format( 'Y-m-d H:i:s O' ); } else { $action_date = '–'; } return $action_date; }