diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php
index fab280c..5e9779d 100644
--- a/php/classes/AmdaAction.php
+++ b/php/classes/AmdaAction.php
@@ -1355,8 +1355,12 @@ class AmdaAction {
         	return array('success' => true, 'alreadyUsed' => $alreadyUsed);
         }
 
-		public function epnTapGetGranules($table_name, $access_url, $filter, $select) {
-			return (new EpnTapMgr)->getGranules($table_name, $access_url, $filter, $select);
+		public function epnTapGetGranules($table_name, $access_url, $filter, $select, $limit, $offset) {
+			return (new EpnTapMgr)->getGranules($table_name, $access_url, $filter, $select, $limit, $offset);
+		}
+
+		public function epnTapGetNbRows($table_name, $access_url, $filter) {
+			return (new EpnTapMgr)->getNbRows($table_name, $access_url, $filter);
 		}
 }
 ?>
diff --git a/php/classes/EpnTapMgr.php b/php/classes/EpnTapMgr.php
index 79f1697..a7b75d7 100644
--- a/php/classes/EpnTapMgr.php
+++ b/php/classes/EpnTapMgr.php
@@ -18,13 +18,14 @@ class EpnTapMgr {
 	}
 
 	private function dateToJD($gregorian_date) {
-		list($month, $day, $year) = split('[/.-]', $gregorian_date);
-		return GregorianToJD($month, $day, $year);
+		list($day, $month, $year, $hours, $minutes, $seconds) = split('[/ :]', $gregorian_date);
+		return GregorianToJD($month, $day, $year) + $hours/24 + $minutes/(24*60) + $seconds/(24*60*60);
 	}
 
 	public function JDTodate($jd) {
 		list($month, $day, $year) = split('/', JDToGregorian($jd));
-		return "$day/$month/$year";
+		$date = sprintf('%02d', $day) . '/' . sprintf('%02d', $month) . '/' . sprintf('%04d', $year);
+		return ($date == '00/00/0000') ? '' : $date;
 	}
 
 	public function createFilter($target_name, $dataproduct_type, $time_min, $time_max) {
@@ -37,7 +38,6 @@ class EpnTapMgr {
 			array_push($filter, "time_min <= " . $this->dateToJD($time_min));
 		if($time_max)
 			array_push($filter, "time_max >= " . $this->dateToJD($time_max));
-
 		return (count($filter) > 0 ? ' WHERE ' . join(' AND ', $filter) : '');
 	}
 
@@ -49,18 +49,26 @@ class EpnTapMgr {
 		$this->addLog("Query URL: " . $url);
 		$votMgr->load($url);
 		$result = $votMgr->isValidSchema() ? $votMgr->parseStream() : NULL;
+		return $result;
+	}
+
+	/* filter order: $target_name, $time_min, $time_max, $table_name, $access_url */
+	public function getGranules($table_name, $access_url, $filter, $select, $limit, $offset) {
+		$query = "SELECT TOP $limit " . join(', ', $select) . " FROM $table_name.epn_core " . $this->createFilter($filter[0], $filter[1], $filter[2], $filter[3]) . " OFFSET $offset";
+		// return $query;
+		$result = $this->request($access_url, $query);
 		for ($i = 0 ; $i < sizeof($result) ; $i++) {
-			$result[$i]['time_min'] = JDToGregorian($result[$i]['time_min']);//$this->JDTodate($result[$i]['time_min']);
+			$result[$i]['time_min'] = $this->JDTodate($result[$i]['time_min']);
 			$result[$i]['time_max'] = $this->JDTodate($result[$i]['time_max']);
 		}
 		return $result;
 	}
 
-	/* filtre order: $target_name, $time_min, $time_max, $table_name, $access_url */
-	public function getGranules($table_name, $access_url, $filter, $select) {
-		$query = "SELECT " . join(', ', $select) . " FROM $table_name.epn_core" . $this->createFilter($filter[0], $filter[1], $filter[2], $filter[3]);
+	public function getNbRows($table_name, $access_url, $filter) {
+		$query = "SELECT COUNT(*) AS nb_rows FROM $table_name.epn_core " . $this->createFilter($filter[0], $filter[1], $filter[2], $filter[3]);
 		// return $query;
-		return $this->request($access_url, $query);
+		return $this->request($access_url, $query)[0]['nb_rows'];
 	}
+
 }
 ?>
diff --git a/php/config.php b/php/config.php
index 9d856db..c9bfaf4 100644
--- a/php/config.php
+++ b/php/config.php
@@ -384,7 +384,8 @@ $API = array(
         'isSharedObjectNameAlreadyUsed' => array(
         	'len'=>1
         ),
-		'epnTapGetGranules' => array('len'=>4)
+		'epnTapGetGranules' => array('len'=>6),
+		'epnTapGetNbRows' => array('len'=>3)
       )
     )
 );
--
libgit2 0.21.2