示例#1
0
文件: Object.php 项目: tokushima/ebi
 private function ___fm___($f = null, $d = null)
 {
     $p = $this->_;
     $v = method_exists($this, $m = '__get_' . $p . '__') ? call_user_func([$this, $m]) : $this->___get___();
     switch ($this->prop_anon($p, 'type')) {
         case 'timestamp':
             return $v === null ? null : date(empty($f) ? \ebi\Conf::timestamp_format() : $f, (int) $v);
         case 'date':
             return $v === null ? null : date(empty($f) ? \ebi\Conf::date_format() : $f, (int) $v);
         case 'time':
             if ($v === null) {
                 return 0;
             }
             $h = floor($v / 3600);
             $i = floor(($v - $h * 3600) / 60);
             $s = floor($v - $h * 3600 - $i * 60);
             $m = str_replace(' ', '0', rtrim(str_replace('0', ' ', substr($v - $h * 3600 - $i * 60 - $s, 2, 12))));
             return ($h == 0 ? '' : $h . ':') . sprintf('%02d:%02d', $i, $s) . ($m == 0 ? '' : '.' . $m);
         case 'intdate':
             if ($v === null) {
                 return null;
             }
             return str_replace(['Y', 'm', 'd'], [substr($v, 0, -4), substr($v, -4, 2), substr($v, -2, 2)], empty($f) ? \ebi\Conf::date_format() : $f);
         case 'boolean':
             return $v ? isset($d) ? $d : 'true' : (empty($f) ? 'false' : $f);
     }
     return $v;
 }
示例#2
0
 /**
  * フォーマットした日付を返す
  * @param integer $value 時間
  * @param string $format フォーマット文字列 ( http://jp2.php.net/manual/ja/function.date.php )
  * @return string
  */
 public function date_format($format = null, $value = null)
 {
     if (empty($format)) {
         $format = \ebi\Conf::timestamp_format();
     }
     if (empty($value)) {
         $value = time();
     }
     return date($format, $value);
 }
示例#3
0
文件: Log.php 项目: tokushima/ebi
 public function time($format = null)
 {
     if (empty($format)) {
         $format = \ebi\Conf::timestamp_format();
     }
     return date($format, $this->time);
 }