function test_year()
 {
     $dateAndTimeA = DateAndTime::withYearDay(2005, 0);
     $dateAndTimeB = DateAndTime::withYearDay(2005, 1);
     $dateAndTimeC = DateAndTime::fromString('2005');
     $tz = DateAndTime::localTimeZone();
     $this->assertTrue($dateAndTimeA->isEqual($dateAndTimeB));
     $this->assertTrue($dateAndTimeA->isEqual($dateAndTimeC));
     $this->assertEqual($dateAndTimeA->asString(), '2005-01-01T00:00:00' . $tz->asString());
     $this->assertEqual($dateAndTimeB->asString(), '2005-01-01T00:00:00' . $tz->asString());
     $this->assertEqual($dateAndTimeC->asString(), '2005-01-01T00:00:00' . $tz->asString());
 }
Ejemplo n.º 2
0
 /**
  * Answer the duration we are offset from UTC
  * 
  * @return object Duration
  * @access public
  * @static
  * @since 5/3/05
  */
 static function localOffset()
 {
     $timeZone = DateAndTime::localTimeZone();
     return $timeZone->offset();
 }