<?php
//
//
#Автор: Jquery
#telegram: @justin_olivier
//
//
// Время
function times($time=NULL){
	if ($time == NULL)$time = time();
	$timep="".date("j M yг. в H:i", $time)."";
	$time_p[0]=date("j n Y", $time);
	$time_p[1]=date("H:i", $time);
	
	if ($time_p[0] == date("j n Y"))$timep = date("H:i:s", $time);
	if ($time_p[0] == date("j n Y", time()-60*60*24))$timep = "Вчера в $time_p[1]";
	
	$timep=str_replace("Jan","Янв",$timep);
	$timep=str_replace("Feb","Фев",$timep);
	$timep=str_replace("Mar","Мар",$timep);
	$timep=str_replace("May","Мая",$timep);
	$timep=str_replace("Apr","Апр",$timep);
	$timep=str_replace("Jun","Июня",$timep);
	$timep=str_replace("Jul","Июля",$timep);
	$timep=str_replace("Aug","Авг",$timep);
	$timep=str_replace("Sep","Сент",$timep);
	$timep=str_replace("Oct","Окт",$timep);
	$timep=str_replace("Nov","Нояб",$timep);
	$timep=str_replace("Dec","Дек",$timep);
	return $timep;
}

//
//
function timer($var){
	$timer = $var - time();
	$isDay = floor($timer/86400);
	$isHour = floor($timer/3600);
	$isMin = floor($timer/60);
	$hourOs = $isHour  - ($isDay*24);
	$minOs = $isMin  - ($isHour * 60);
	$secOs = $timer  - ($isMin * 60);
	if($isDay > '0'){$day = $isDay." д ";}
	if($hourOs > '0'){$hour = $hourOs." ч ";}
	if($minOs > '0'){$minute = $minOs." м ";}
	if($secOs > '0'){$sec = $secOs ." с ";}
	$times = $day.$hour.$minute.$sec;
	return $times;
}
//
//