示例#1
0
文件: Date.php 项目: jasmun/Noco100
 /**
  * Formats a timestamp
  *
  * @param $ts
  * @param $format the output format, blog default will be used if empty
  * @internal param timestamp $time
  * @return string the formatted date
  */
 public static function formatTs($ts, $format = null)
 {
     $dt = new DateTime();
     $dt->setTimestamp($ts);
     if (empty($format)) {
         $format = IfwPsn_Wp_Proxy_Blog::getDateFormat() . ' ' . IfwPsn_Wp_Proxy_Blog::getTimeFormat();
     }
     $offset = IfwPsn_Wp_Proxy_Blog::getGmtOffset();
     if (empty($offset)) {
         $offset = 0;
     }
     return date($format, $dt->format('U') + $offset * 3600);
 }