* Code for genDateUsed

This commit is contained in:
guofeilong
2023-02-08 14:57:43 +08:00
parent 98c99cf572
commit ffb6b0a0c3
3 changed files with 30 additions and 1 deletions
+20
View File
@@ -591,4 +591,24 @@ class adminModel extends model
return (bool)$connected;
}
/**
* get date used.
*
* @access public
* @return $interval
*/
public function genDateUsed()
{
$firstUseDate = $this->dao->select('date')->from(TABLE_ACTION)
->where('date')->gt('0000-00-00')
->andWhere('actor')->eq($this->app->user->account)
->orderBy('date_asc')
->fetch('date');
$firstUseDate = date_create($firstUseDate);
$dateNow = date("Y-m-d H:i", time());
$dateNow = date_create($dateNow);
$interval = date_diff($dateNow, $firstUseDate);
return $interval;
}
}