You are here

public function BiblioEntrezClient::setDateRange in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 modules/pubmed/EntrezClient.php \BiblioEntrezClient::setDateRange()
  2. 7 modules/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

pubmed/EntrezClient.php, line 220
EntrezClient.php Provides Entrez client to retrieve items from the NCBI databases Orginally writen by Stefan Freudenberg

Class

BiblioEntrezClient
@file EntrezClient.php Provides Entrez client to retrieve items from the NCBI databases Orginally writen by Stefan Freudenberg

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,
  );
}