コード例 #1
0
 function SummaryStats()
 {
     // initialize ADOdb
     $this->Model();
     // common object for all methods so that we can reuse caches
     $this->articles = new Articles();
     $this->blogs = new Blogs();
     // calculate the date limits
     $t = new Timestamp();
     $this->_now = $t->getTimestamp();
     // 7 days ago
     $t->subtractSeconds(7 * 24 * 60 * 60);
     $this->_sevenDaysAgo = $t->getTimestamp();
 }
コード例 #2
0
 /**
  * Static method that returns a timestamp after applying a time
  * difference to it.
  *
  * @static
  * @param timeStamp The original ISO timestamp
  * @param timeDiff The time difference that we'd like to apply to the
  * original timestamp
  */
 function getDateWithOffset($timeStamp, $timeDiff)
 {
     if ($timeDiff != 0) {
         $t = new Timestamp($timeStamp);
         //
         // we can't use the addSeconds method with a negative offset
         // so we have to check wether the offset is positive or negative
         // and then use the correct one...
         //
         if ($timeDiff > 0) {
             $t->addSeconds($timeDiff * 3600);
         } else {
             $t->subtractSeconds($timeDiff * -3600);
         }
         $date = $t->getTimestamp();
     } else {
         $date = $timeStamp;
     }
     return $date;
 }