Exemplo n.º 1
0
 /**
  * Create a new instance from Date and Time objects
  * 
  * @param optional string $class DO NOT USE OUTSIDE OF PACKAGE.
  *		This parameter is used to get around the limitations of not being
  *		able to find the class of the object that recieved the initial 
  *		method call.
  * @return object TimeStamp
  * @access public
  * @since 5/12/05
  * @static
  */
 static function withDateAndTime($aDate, $aTime, $class = 'TimeStamp')
 {
     $obj = parent::withDateAndTime($aDate, $aTime, $class);
     return $obj;
 }
 /**
  * Test alterate static creations
  */
 function test_creation_methods()
 {
     $dateAndTime = DateAndTime::withYearMonthDayHourMinuteSecondOffset(2005, 5, 4, 15, 25, 10, $null = NULL);
     $this->assertEqual($dateAndTime->year(), 2005);
     $this->assertEqual($dateAndTime->month(), 5);
     $this->assertEqual($dateAndTime->dayOfMonth(), 4);
     $this->assertEqual($dateAndTime->hour(), 15);
     $this->assertEqual($dateAndTime->hour12(), 3);
     $this->assertEqual($dateAndTime->minute(), 25);
     $this->assertEqual($dateAndTime->second(), 10);
     $dateAndTime = DateAndTime::withYearMonthDayHourMinute(2005, 5, 4, 15, 25);
     $this->assertEqual($dateAndTime->year(), 2005);
     $this->assertEqual($dateAndTime->month(), 5);
     $this->assertEqual($dateAndTime->dayOfMonth(), 4);
     $this->assertEqual($dateAndTime->hour(), 15);
     $this->assertEqual($dateAndTime->hour12(), 3);
     $this->assertEqual($dateAndTime->minute(), 25);
     $this->assertEqual($dateAndTime->second(), 0);
     $dateAndTime = DateAndTime::withYearDay(1950, 1);
     $this->assertEqual($dateAndTime->year(), 1950);
     $this->assertEqual($dateAndTime->month(), 1);
     $this->assertEqual($dateAndTime->dayOfMonth(), 1);
     $this->assertEqual($dateAndTime->hour(), 0);
     $this->assertEqual($dateAndTime->hour12(), 12);
     $this->assertEqual($dateAndTime->minute(), 0);
     $this->assertEqual($dateAndTime->second(), 0);
     $dateAndTime = DateAndTime::withYearMonthDay(2005, 1, 1);
     $this->assertEqual($dateAndTime->year(), 2005);
     $this->assertEqual($dateAndTime->month(), 1);
     $this->assertEqual($dateAndTime->dayOfMonth(), 1);
     $this->assertEqual($dateAndTime->hour(), 0);
     $this->assertEqual($dateAndTime->hour12(), 12);
     $this->assertEqual($dateAndTime->minute(), 0);
     $this->assertEqual($dateAndTime->second(), 0);
     $date = Date::withYearMonthDay(2005, 5, 4);
     $time = Time::withHourMinuteSecond(15, 25, 10);
     $dateAndTime = DateAndTime::withDateAndTime($date, $time);
     $this->assertEqual($dateAndTime->year(), 2005);
     $this->assertEqual($dateAndTime->month(), 5);
     $this->assertEqual($dateAndTime->dayOfMonth(), 4);
     $this->assertEqual($dateAndTime->hour(), 15);
     $this->assertEqual($dateAndTime->hour12(), 3);
     $this->assertEqual($dateAndTime->minute(), 25);
     $this->assertEqual($dateAndTime->second(), 10);
 }
Exemplo n.º 3
0
 /**
  * Create a new instance from Date and Time objects
  * 
  * @param optional string $class DO NOT USE OUTSIDE OF PACKAGE.
  *		This parameter is used to get around the limitations of not being
  *		able to find the class of the object that recieved the initial 
  *		method call.
  * @return object StorableTime
  * @access public
  * @since 5/12/05
  * @static
  */
 static function withDateAndTime($aDate, $aTime, $class = 'StorableTime')
 {
     return parent::withDateAndTime($aDate, $aTime, $class);
 }