function DeltaDate() { // configure the base date $base_day = 24; // no leading "0" $base_mon = 8; // no leading "0" $base_yr = 2004; // use 4 digit years! $current_day = date ("j"); $current_mon = date ("n"); $current_yr = date ("Y"); $base_mon_max = date ("t",mktime (0,0,0,$base_mon,$base_day,$base_yr)); $base_day_diff = $base_mon_max - $base_day; $base_mon_diff = 12 - $base_mon - 1; $start_day = 1; $start_mon = 1; $start_yr = $base_yr + 1; $day_diff = ($current_day - $start_day) + 1; // add today $mon_diff = ($current_mon - $start_mon) + 1; // add current month $yr_diff = ($current_yr - $start_yr); $day_diff = $day_diff + $base_day_diff; $mon_diff = $mon_diff + $base_mon_diff; if ($day_diff >= $base_mon_max) { $day_diff = $day_diff - $base_mon_max; $mon_diff = $mon_diff + 1; } // handle overflow of years if ($mon_diff >= 12) { $mon_diff = $mon_diff - 12; $yr_diff = $yr_diff + 1; } // the results are here: // $yr_diff --> the years between the two dates // $mon_diff --> the month between the two dates // $day_diff --> the days between the two dates // **************************************************************************** // this is just to make it look nicer $years = "лет"; $days = "дней"; if ($yr_diff == "1") $years = "год"; if ($day_diff == "1") $days = "день"; // here we go $outputres $yr_diff." ".$years.", ".$mon_diff." месяцев и ".$day_diff." ".$days; return $outputres; }