public function ParsePostData() {
			$blnChanged = false;
			$dttNewDateTime = new QDateTime();

			// Update Date Component
			switch ($this->strCalendarType) {
				case QCalendarType::DateOnly:
				case QCalendarType::DateTime:
				case QCalendarType::DateTimeSeconds:
				$strKey = $this->strControlId . "_intTimestamp";
				if (array_key_exists($strKey, $_POST)) {
					// If no date was set, set to null and return
					$intTimestamp = $_POST[$strKey];
					if (!$intTimestamp) {
						$this->intTimestamp = null;
						return;
					}

					// Otherwise, set up a new date object, and update dttNewDateTime accordingly
					$blnChanged = true;
					$dttSelectedDate = new QDateTime($_POST[$strKey]);

					$dttNewDateTime->SetDate($dttSelectedDate->Year, $dttSelectedDate->Month, $dttSelectedDate->Day);					
				}
			}

			// Update Time Component
			switch ($this->strCalendarType) {
				case QCalendarType::TimeOnly:
				case QCalendarType::TimeSecondsOnly:
				case QCalendarType::DateTime:
				case QCalendarType::DateTimeSeconds:
					// Hour
					$strKey = $this->strControlId . "_intHour";
					if (array_key_exists($strKey, $_POST)) {
						$blnChanged = true;
						$dttNewDateTime->SetTime($_POST[$strKey], $dttNewDateTime->Minute, $dttNewDateTime->Second);
					}

					// Minute
					$strKey = $this->strControlId . "_intMinute";
					if (array_key_exists($strKey, $_POST)) {
						$blnChanged = true;
						$dttNewDateTime->SetTime($dttNewDateTime->Hour, $_POST[$strKey], $dttNewDateTime->Second);
					}

					// Second
					$strKey = $this->strControlId . "_intSecond";
					if (array_key_exists($strKey, $_POST)) {
						$blnChanged = true;
						$dttNewDateTime->SetTime($dttNewDateTime->Hour, $dttNewDateTime->Minute, $_POST[$strKey]);
					}
			}

			// Update local intTimestamp
			$this->intTimestamp = $dttNewDateTime->Timestamp;
		}
示例#2
0
 /**
  * Constructs a new QDateTime as a time-only value.  Uses default QDateTime constructor
  * and simply nulls out the time value right afterward.
  * @param mixed $mixValue
  * @param DateTimeZone $objTimeZone
  * @return QDateTime
  */
 public static function FromTimeOnly($mixValue = null, DateTimeZone $objTimeZone = null)
 {
     $dttToReturn = new QDateTime($mixValue, $objTimeZone);
     $dttToReturn->SetDate(null, null, null);
     return $dttToReturn;
 }