コード例 #1
0
 /**
  * Check the equality of a DateAndTime against a PHP DateTime object
  * 
  * @param object DateAndTime $dateAndTime
  * @param object DateTime $dateTime
  * @return void
  * @access protected
  * @since 11/21/08
  */
 protected function checkEquality(DateAndTime $dateAndTime, DateTime $dateTime)
 {
     print "<h4>" . $dateAndTime->asString() . "</h4>";
     print "Year: ";
     $this->assertEqual($dateAndTime->year(), intval($dateTime->format('Y')));
     print "Month: ";
     $this->assertEqual($dateAndTime->month(), intval($dateTime->format('n')));
     print "Day of Month: ";
     $this->assertEqual($dateAndTime->dayOfMonth(), intval($dateTime->format('j')));
     print "Day of Year: ";
     $this->assertEqual($dateAndTime->dayOfYear() - 1, intval($dateTime->format('z')));
     print "Hour: ";
     $this->assertEqual($dateAndTime->hour(), intval($dateTime->format('G')));
     print "Minute: ";
     $this->assertEqual($dateAndTime->minute(), intval($dateTime->format('i')));
     print "Second: ";
     $this->assertEqual($dateAndTime->second(), intval($dateTime->format('s')));
     // 		print "TZ abbriviation: ";
     // 		$this->assertEqual($dateAndTime->timeZoneAbbreviation(), $dateTime->format('T'));
     $datTZone = $dateAndTime->timeZone();
     $dtTZone = $dateTime->getTimezone();
     print "TZ seconds: ";
     $this->assertEqual($datTZone->offset()->asSeconds(), intval($dateTime->format('Z')));
 }