You are here

public function BiblioEntrezClient::setDateRange in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/pubmed/EntrezClient.php \BiblioEntrezClient::setDateRange()
  2. 6 pubmed/EntrezClient.php \BiblioEntrezClient::setDateRange()
  3. 7.2 modules/pubmed/EntrezClient.php \BiblioEntrezClient::setDateRange()

Sets two specific dates bounding the results.

Parameters

$minDate:

$maxDate:

Throws

Exception

File

modules/pubmed/EntrezClient.php, line 214
Provides Entrez client to retrieve items from the NCBI databases.

Class

BiblioEntrezClient

Code

public function setDateRange($minDate, $maxDate = NULL) {
  if (is_null($maxDate)) {
    $maxDate = date('Y/m/d');
  }
  else {
    $maxDate = date('Y/m/d', strtotime($maxDate));
  }
  $minDate = date('Y/m/d', strtotime($minDate));
  if ($maxDate < $minDate) {
    throw new Exception('First argument must be an earlier date.');
  }
  $this->dateRange = array(
    $minDate,
    $maxDate,
  );
}