$currentDT = new \DateTime();
$filterRange = new \DateInterval('PT30S');
$filterDate = $currentDT->sub($filterRange);
var_dump($currentDT);
var_dump($filterDate);
OUTPUT:PHP日期時間子問題
object(DateTime)[246]
public 'date' => string '2011-12-10 15:53:42' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'America/New_York' (length=16)
object(DateTime)[246]
public 'date' => string '2011-12-10 15:53:42' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'America/New_York' (length=16)
$ currentDT和$ filterDate都是一樣的...即使他們應該是30年代不同。任何想法爲什麼?