File size: 1.44Kb
<?php
class timedate
{
function when($time=NULL)
{
global $time_post;
if ($line_time==NULL)$line_time=time();
if (isset($time_post))$time=$time+$time_post['set_timesdvig']*60*60;
$timep="".date("j M Y в H:i", $time)."";
$time_en[0]=date("j n Y", $time);
$time_en[1]=date("H:i", $time);
if ($time_en[0]==date("j n Y"))$timep= date("H:i:s", $time);
if (isset($time_post)){
if ($time_en[0]==date("j n Y", time()+$time_post['set_timesdvig']*60*60))$timep=date("H:i:s", $time);
if ($time_en[0]==date("j n Y", time()-60*60*(24-$time_post['set_timesdvig'])))$timep="Вчера в $time_en[1]";}
else{
if ($time_en[0]==date("j n Y"))$timep=date("H:i:s", $time);
if ($time_en[0]==date("j n Y", time()-60*60*24))$timep="Вчера в $time_en[1]";}
$times = array();
$times[0] = 'Jan';
$times[1] = 'Feb';
$times[2] = 'Mar';
$times[3] = 'May';
$times[4] = 'Apr';
$times[5] = 'Jun';
$times[6] = 'Jul';
$times[7] = 'Aug';
$times[8] = 'Sep';
$times[9] = 'Oct';
$times[10] ='Nov';
$times[11] = 'Dec';
$time_ob = array();
$time_ob[0] = 'Янв';
$time_ob[1] = 'Фев';
$time_ob[2] = 'Марта';
$time_ob[3] = 'Мая';
$time_ob[4] = 'Апр';
$time_ob[5] = 'Июня';
$time_ob[6] = 'Июля';
$time_ob[7] = 'Авг';
$time_ob[8] = 'Сент';
$time_ob[9] = 'Окт';
$time_ob[10] = 'Ноября';
$time_ob[11] = 'Дек';
$time_result = str_replace($times,$time_ob,$timep);
return $time_result;
}
}
$timedate = new timedate;
?>