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


PHP QDateTime::qFormat方法代码示例

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


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

示例1: __set

 public function __set($strName, $mixValue)
 {
     switch ($strName) {
         case 'MaxDate':
         case 'Maximum':
             try {
                 if (is_string($mixValue)) {
                     $mixValue = new QDateTime($mixValue);
                 }
                 parent::__set('MaxDate', QType::Cast($mixValue, QType::DateTime));
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case 'MinDate':
         case 'Minimum':
             try {
                 if (is_string($mixValue)) {
                     $mixValue = new QDateTime($mixValue);
                 }
                 parent::__set('MinDate', QType::Cast($mixValue, QType::DateTime));
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case 'DateTime':
             try {
                 $this->dttDateTime = QType::Cast($mixValue, QType::DateTime);
                 if ($this->dttDateTime && $this->dttDateTime->IsNull()) {
                     $this->dttDateTime = null;
                     $this->blnModified = true;
                 }
                 if (!$this->dttDateTime || !$this->strDateTimeFormat) {
                     parent::__set('Text', '');
                 } else {
                     parent::__set('Text', $this->dttDateTime->qFormat($this->strDateTimeFormat));
                 }
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case 'JqDateFormat':
             try {
                 parent::__set($strName, $mixValue);
                 $this->strDateTimeFormat = QCalendar::qcFrmt($this->JqDateFormat);
                 // trigger an update to reformat the text with the new format
                 $this->DateTime = $this->dttDateTime;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case 'DateTimeFormat':
         case 'DateFormat':
             try {
                 $this->strDateTimeFormat = QType::Cast($mixValue, QType::String);
                 parent::__set('JqDateFormat', QCalendar::jqFrmt($this->strDateTimeFormat));
                 // trigger an update to reformat the text with the new format
                 $this->DateTime = $this->dttDateTime;
             } catch (QInvalidCastException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
         case 'Text':
             parent::__set($strName, $mixValue);
             $this->dttDateTime = new QDateTime($this->strText);
             break;
         default:
             try {
                 parent::__set($strName, $mixValue);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
             break;
     }
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:81,代码来源:QDatepickerBoxBase.class.php

示例2: Objects

		<input type="submit" id="double" name="double" value="Save 2 Objects (same Instance)"/></p>

		<p>Using <strong>$blnForceUpdate</strong> to avoid the <strong>Optimistic Locking Exception</strong><br/>
		<input type="submit" id="double_force" name="double_force" value="Force Update Second Object"/></p>
	</form>
<?php 
// Load the Two Person objects (same instance -- let them both be Person ID #4)
$objPerson1 = PersonWithLock::Load(5);
$objPerson2 = PersonWithLock::Load(5);
// Some RDBMS Vendors' TIMESTAMP is only precise to the second
// Let's force a delay to the next second to ensure timestamp functionality
// Note: on most web applications, because Optimistic Locking are more application user-
// level constraints instead of systematic ones, this delay is inherit with the web
// application paradigm.  The following delay is just to simulate that paradigm.
$dttNow = new QDateTime(QDateTime::Now);
while ($objPerson1->SysTimestamp == $dttNow->qFormat(QDateTime::FormatIso)) {
    $dttNow = new QDateTime(QDateTime::Now);
}
// Make Changes to the Object so that the Save Will Update Something
if ($objPerson1->FirstName == 'Al') {
    $objPerson1->FirstName = 'Alfred';
    $objPerson2->FirstName = 'Al';
} else {
    $objPerson1->FirstName = 'Al';
    $objPerson2->FirstName = 'Alfred';
}
switch (true) {
    case array_key_exists('single', $_POST):
        $objPerson1->Save();
        _p('Person Id #' . $objPerson1->Id . ' saved.  Name is now ' . $objPerson1->FirstName);
        _p('.<br/>', false);
开发者ID:tomVertuoz,项目名称:framework,代码行数:31,代码来源:optimistic_locking.php

示例3: NowToString

 public static function NowToString($strFormat = null)
 {
     $dttNow = new QDateTime(QDateTime::Now);
     return $dttNow->qFormat($strFormat);
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:5,代码来源:QDateTime.class.php

示例4: testFormat

 public function testFormat()
 {
     $obj1 = new QDateTime("2002-3-5 13:15");
     $this->assertEqual($obj1->qFormat("M/D/YY h:mm z"), "3/5/02 1:15 pm");
     $this->assertEqual($obj1->qFormat("DDD MMM D YYYY"), "Tue Mar 5 2002");
     $this->assertEqual($obj1->qFormat("One random DDDD in MMMM"), "One random Tuesday in March");
     //  Back compat
     $this->assertEqual($obj1->qFormat("M/D/YY h:mm z"), $obj1->qFormat("M/D/YY h:mm z"));
 }
开发者ID:tomVertuoz,项目名称:framework,代码行数:9,代码来源:QDateTimeTests.php


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