|
|
@ -21,7 +21,9 @@ class Format |
|
|
|
/* Date & time */ |
|
|
|
static protected $time_format = 'H:i:s'; |
|
|
|
static protected $date_format = 'd.m.Y'; |
|
|
|
static protected $today_format = 'Сегодня'; |
|
|
|
static protected $date_time_format = 'H:i d.m.Y'; |
|
|
|
static protected $today_time_format = 'H:i Сегодня'; |
|
|
|
static protected $timezone_offset = 0; |
|
|
|
|
|
|
|
/* money */ |
|
|
@ -85,8 +87,11 @@ class Format |
|
|
|
*/ |
|
|
|
static public function int2date($timestamp = 0, $hours = true) |
|
|
|
{ |
|
|
|
$date = date(($hours) ? self::$date_time_format : self::$date_format , $timestamp); |
|
|
|
return $date; |
|
|
|
if (date('Ymd') == date('Ymd', $timestamp)) { |
|
|
|
return date(($hours) ? self::$today_time_format : self::$today_format , $timestamp); |
|
|
|
} |
|
|
|
|
|
|
|
return date(($hours) ? self::$date_time_format : self::$date_format , $timestamp); |
|
|
|
} |
|
|
|
|
|
|
|
static public function int2rusDate($timestamp = 0, $hours = false) |
|
|
@ -110,6 +115,18 @@ class Format |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Установка форматов даты |
|
|
|
* |
|
|
|
*/ |
|
|
|
static public function setDateTimeFormat($date_time_format, $today_time_format = false) |
|
|
|
{ |
|
|
|
self::$date_time_format = $date_time_format; |
|
|
|
if ($today_time_format) { |
|
|
|
self::$today_time_format = $today_time_format; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Преобразует время в секунды. |
|
|
|
* |
|
|
|
* @param string $time |
|
|
|