WordPress at a glance
function is not described

Automattic\WooCommerce\Admin\API\Reports\Downloads

DataStore::add_time_period_sql_params() protected WC 1.0

Gets WHERE time clause of SQL request with date-related constraints.

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

No Hooks.

Return

String. Nothing.

Usage

// protected - for code of main (parent) or child class
$result = $this->add_time_period_sql_params( $query_args, $table_name );
$query_args(array) (required)
Parameters supplied by the user.
$table_name(string) (required)
Name of the db table relevant for the date constraint.

Code of DataStore::add_time_period_sql_params() WC 5.2.2

<?php
protected function add_time_period_sql_params( $query_args, $table_name ) {
	$where_time = '';
	if ( $query_args['before'] ) {
		$datetime_str = $query_args['before']->format( TimeInterval::$sql_datetime_format );
		$where_time  .= " AND {$table_name}.timestamp <= '$datetime_str'";

	}

	if ( $query_args['after'] ) {
		$datetime_str = $query_args['after']->format( TimeInterval::$sql_datetime_format );
		$where_time  .= " AND {$table_name}.timestamp >= '$datetime_str'";
	}

	return $where_time;
}