public function testTimestamp(){ $d = new ADateTime("2004-08-04 20:06:14"); $stamp = $d->getTimeStamp(); $d2 = new ADateTime(date("Y-m-d H:i:s", $stamp)); $d3 = new ADateTime(gmdate("Y-m-d H:i:s", $stamp)); $this->assertEqual($d->toString(), $d2->toString(), "dates are the same"); $this->assertEqual($d->toString(), $d3->toString(), "server timezone is correct"); }
/** * this will return the timestamp, assuming hour, minute and second are 0 * IE, this will round down to the nearest day */ public function getTimeStampFloor(){ $dt = new ADateTime(substr($this->toString(), 0, 10) . " 00:00:00"); return $dt->getTimeStamp(); }