/**
  * 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.º 2
0
 /**
  * Answer the current end date
  * 
  * @return object DateAndTime
  * @access public
  * @since 3/8/06
  */
 function getEndDate()
 {
     if (RequestContext::value("endYear")) {
         return DateAndTime::withYearMonthDayHourMinute(RequestContext::value("endYear"), RequestContext::value("endMonth"), RequestContext::value("endDay"), RequestContext::value("endHour"), 0);
     } else {
         return DateAndTime::tomorrow();
     }
 }
Exemplo n.º 3
0
 /**
  * Create a new instance.
  * 
  * @param integer $anIntYear
  * @param integer $anIntOrStringMonth
  * @param integer $anIntDay
  * @param integer $anIntHour
  * @param integer $anIntMinute
  * @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
  * @static
  * @since 5/4/05
  */
 static function withYearMonthDayHourMinute($anIntYear, $anIntOrStringMonth, $anIntDay, $anIntHour, $anIntMinute, $class = 'TimeStamp')
 {
     $obj = parent::withYearMonthDayHourMinute($anIntYear, $anIntOrStringMonth, $anIntDay, $anIntHour, $anIntMinute, $class);
     return $obj;
 }
Exemplo n.º 4
0
 /**
  * Create a new instance.
  * 
  * @param integer $anIntYear
  * @param integer $anIntOrStringMonth
  * @param integer $anIntDay
  * @param integer $anIntHour
  * @param integer $anIntMinute
  * @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
  * @static
  * @since 5/4/05
  */
 static function withYearMonthDayHourMinute($anIntYear, $anIntOrStringMonth, $anIntDay, $anIntHour, $anIntMinute, $class = 'StorableTime')
 {
     return parent::withYearMonthDayHourMinute($anIntYear, $anIntOrStringMonth, $anIntDay, $anIntHour, $anIntMinute, $class);
 }