Example #1
0
 /**
  * Convert a DateTime (or a timestamp) into a SQL
  * DATE compatible value.
  *
  * @param DateTime $ts the date to convert. NULL
  * 		will use the current date.
  */
 public function sqltime($ts)
 {
     $ts = \Concerto\std::timestamp($ts);
     return $this->sqlstr(date("H:i:s", $ts));
 }
Example #2
0
 /**
  * Converts a timestamp to a Javascript Date object. 
  */
 public static function timestamp2js($ts)
 {
     $ts = std::timestamp($ts);
     // ensure it is a timestamp
     $y = date('Y', $ts);
     $m = intval(date('n', $ts) - 1);
     $d = date('j', $ts);
     return "new Date( {$y}, {$m}, {$d} )";
 }