我有同樣的問題,我有一個小功能解決它......
$區= dateadde( 「d」, - 1,$細胞);
其中: [ #輸入日期= 23/08/2011
function dateadde($interval, $number, $date)
{
$jour=substr("$date", 0, 2);
$mois=substr("$date", 3, 2);
$annee=substr("$date", 6, 4);
$adate = mktime(0,0,0,$mois,$jour,$annee);
$date_time_array = getdate($adate);
$hours = $date_time_array['hours'];
$minutes = $date_time_array['minutes'];
$seconds = $date_time_array['seconds'];
$month = $date_time_array['mon'];
$day = $date_time_array['mday'];
$year = $date_time_array['year'];
switch ($interval)
{
case 'yyyy':
$year+=$number;
break;
case 'q':
$year+=($number*3);
break;
case 'm':
$month+=$number;
break;
case 'y':
case 'd':
case 'w':
$day+=$number;
break;
case 'ww':
$day+=($number*7);
break;
}
$timestamp= mktime(0,0,0,$month,$day,$year);
$jourascii=strftime("%d/%m/%Y",$timestamp);
return $jourascii;
}
]
如此糟糕的編輯!
謝謝。 UTC沒有工作,但我設法讓它與另一個時區一起工作。 – Dan 2011-03-07 11:48:55