当前位置: 首页>>代码示例>>PHP>>正文


PHP QDateTime::SetDate方法代码示例

本文整理汇总了PHP中QDateTime::SetDate方法的典型用法代码示例。如果您正苦于以下问题:PHP QDateTime::SetDate方法的具体用法?PHP QDateTime::SetDate怎么用?PHP QDateTime::SetDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDateTime的用法示例。


在下文中一共展示了QDateTime::SetDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ParsePostData

		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;
		}
开发者ID:rommelxcastro,项目名称:CRI-Online-Sales---Admin,代码行数:57,代码来源:QCalendarPopup.class.php

示例2: FromTimeOnly

 /**
  * 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;
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:13,代码来源:QDateTime.class.php


注:本文中的QDateTime::SetDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。