code: public function getArchivedBlogPosts($year, $month = null, $day = null) {
  		$query = $this->getBlogPosts()->dataQuery();
  
  		$stage = $query->getQueryParam("Versioned.stage");
  		if($stage) $stage = '_' . Convert::raw2sql($stage);
  
  		$query->innerJoin("BlogPost", "`SiteTree" . $stage . "`.`ID` = `BlogPost" . $stage . "`.`ID`");
  		$query->where("YEAR(PublishDate) = '" . Convert::raw2sql($year) . "'");
  		if($month) {
  			$query->where("MONTH(PublishDate) = '" . Convert::raw2sql($month) . "'");
  			if($day) {
  				$query->where("DAY(PublishDate) = '" . Convert::raw2sql($day) . "'");
  			}
  		}
  
  		return $this->getBlogPosts()->setDataQuery($query);
  	}
docs: Returns blogs posts for a given date period.
  
  @param $year int
  @param $month int
  @param $dat int
  
  @return DataList