Luge, на правах изврещения PHP: <?php $from=array( "вандемьера", "брюмера", "фримера", "нивоза", "плювиоза", "вантоза", "жерминаля", "флореаля", "прериаля", "мессидора", "термидора", "фрюктидора" ); $to=array( "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", ); $text=preg_replace($from, $to, $text); ?> и т.д.
Не правильно. Ноль: 1970-01-01 00:00:00. А три часа набегает за счет временной зоны. Например, у меня date('Y-m-d H:i:s', 0) будет 1970-01-01 02:00:00. На Камчатке - 1970-01-01 12:00:00
Код (Text): <?php $lang['seconds'] = 'sekundi'; echo show_added('1983-05-05 22:00:00', 10, '2008-05-05 22:00:00'); //translation function function lng($arg) { global $lang; if (isset($lang[$arg])) { return $lang[$arg]; } return $arg; } // 1st parametr - given value is 0000-00-00 00:00:00 // here i create how to display date different before now date (if not now insert 3rd parametr as date) and given value, // displayed variable is 2nd parametr function show_added($date, $short = 3, $t2='') { $t1=strtotime($date); $t2=empty($t2) ? time() : strtotime($t2); if($t1 > $t2) { $time1 = $t2; $time2 = $t1; } else { $time1 = $t1; $time2 = $t2; } $diff = array( 'years' => 0, 'months' => 0, 'weeks' => 0, 'days' => 0, 'hours' => 0, 'minutes' => 0, 'seconds' =>0 ); foreach(array_keys($diff) as $unit) { while(TRUE) { $next = strtotime("+1 $unit", $time1); if($next < $time2) { $time1 = $next; $diff[$unit]++; } else { break; } } } $difference = ''; $a = 0; foreach($diff as $unit => $value) { if(!empty($value)) { $difference .= ($a > 0 ? ' '.lng('and') . ' ' : '') . ($value . ' ' . lng($unit)); $a++; if($a >= $short) { break; } } } $difference = empty($difference) ? "0 ". lng('seconds') : $difference; return $difference; } ?>