Location: PHPKode > projects > DarkCity > includes/DateManager.php
<?php
/**
 * DateManager.php : Gestionaire de Date
 *
 * Date    : 08/07/2009
 * Auteur  : Philippe Bousquet
 * Version : 1.1
 * Contact : <hide@address.com>
 *
 * modification le 08/07/2009 :
 *     Auteur  : Philippe Bousquet
 *     Version : 1.1
 *     Raison  : FS#139 - La banque : ajout du getDateLimite() 
 *
 * Copyright (c) 2008-2009 Philippe & Thierry Bousquet.
 * Ce logiciel est distribué selon les termes de la GNU General Public License v2.
 */

class DateManager {

  function DateManager() {
  }
  
  function getCurrentDate() {
    $result = mysql_query('SELECT UNIX_TIMESTAMP()');	
    $row = mysql_fetch_array($result);
    return $row[0];
  }

  function getFutureDate($secondes) {
    return $this->getCurrentDate() + $secondes;
  }

  function getPastDate($secondes) {
    return $this->getCurrentDate() - $secondes;
  }
  
  function compteRebour($date) {
    $timer = $this->getCurrentDate();	
    return ($date >= $timer ? $date - $timer : 0);
  }

  function mySQLToDate($datetime) {
    return strtotime($datetime);
  }

  function dateToString($date) {
    $dateStr = "";
    if (date("Y-m-d", $this->getCurrentDate()) != date("Y-m-d", $date)) {
    	$dateStr = " le " . date("d/m/Y", $date) . ' ';
    }
    return $dateStr . ' &agrave; '. date("H:i:s", $date);
  }
    
  function getDateLimite() {
    $dateStr = "";
    return strtotime(date("Y-m-d")." 23:59:59");
  }
}

?>
Return current item: DarkCity