- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
public function viewDate($date, $format=null)
{
$data = explode(' ', $date);
$timearray = explode(':', $data[1]);
$time = $timearray[0] . ':' . $timearray[1];
$Today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
$prevToday = mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"));
$dataArray = explode('-', $data[0]);
$baseDate = mktime(0, 0, 0, $dataArray[1], $dataArray[2], $dataArray[0]);
if ($baseDate == $Today) {
$viewDate = ' Сегодня ' . $time;
} elseif ($baseDate == $prevToday) {
$viewDate = ' Вчера ' . $time;
} else {
$viewDate = ' ' . $format . ' ' . $time;
}
$rez = $viewDate;
return ($rez);
}
Комментарии (0) RSS
Добавить комментарий