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


PHP QDateTime::ToString方法代码示例

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


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

示例1: GetEndScript

 public function GetEndScript()
 {
     $strToReturn = parent::GetEndScript();
     if (QDateTime::$Translate) {
         $strShortNameArray = array();
         $strLongNameArray = array();
         $strDayArray = array();
         $dttMonth = new QDateTime('2000-01-01');
         for ($intMonth = 1; $intMonth <= 12; $intMonth++) {
             $dttMonth->Month = $intMonth;
             $strShortNameArray[] = '"' . $dttMonth->ToString('MMM') . '"';
             $strLongNameArray[] = '"' . $dttMonth->ToString('MMMM') . '"';
         }
         $dttDay = new QDateTime('Sunday');
         for ($intDay = 1; $intDay <= 7; $intDay++) {
             $strDay = $dttDay->ToString('DDD');
             $strDay = html_entity_decode($strDay, ENT_COMPAT, QApplication::$EncodingType);
             if (function_exists('mb_substr')) {
                 $strDay = mb_substr($strDay, 0, 2);
             } else {
                 // Attempt to account for multibyte day -- may not work if the third character is multibyte
                 $strDay = substr($strDay, 0, strlen($strDay) - 1);
             }
             $strDay = QApplication::HtmlEntities($strDay);
             $strDayArray[] = '"' . $strDay . '"';
             $dttDay->Day++;
         }
         $strArrays = sprintf('new Array(new Array(%s), new Array(%s), new Array(%s))', implode(', ', $strLongNameArray), implode(', ', $strShortNameArray), implode(', ', $strDayArray));
         $strToReturn .= sprintf('qc.regCAL("%s", "%s", "%s", "%s", %s); ', $this->strControlId, $this->dtxLinkedControl->ControlId, QApplication::Translate('Today'), QApplication::Translate('Cancel'), $strArrays);
     } else {
         $strToReturn .= sprintf('qc.regCAL("%s", "%s", "%s", "%s", null); ', $this->strControlId, $this->dtxLinkedControl->ControlId, QApplication::Translate('Today'), QApplication::Translate('Cancel'));
     }
     return $strToReturn;
 }
开发者ID:harshanurodh,项目名称:qcodo,代码行数:34,代码来源:QCalendar.class.php

示例2: __get

 public function __get($strName)
 {
     switch ($strName) {
         case 'DateRange':
             return sprintf('Takes place from %s to %s', $this->dttDateStart->ToString('MMM D'), $this->dttDateEnd->ToString('MMM D'), $this->MeetsOnInfo);
         case 'MeetsOnInfo':
             if (!is_null($this->intMeetingDay) && !is_null($this->intMeetingStartTime) && !is_null($this->intMeetingEndTime)) {
                 $strArray = array(0 => 'Sunday', 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday');
                 $dttStart = new QDateTime();
                 $dttEnd = new QDateTime();
                 $dttStart->SetTime(floor($this->intMeetingStartTime / 100), $this->intMeetingStartTime % 100, 0);
                 $dttEnd->SetTime(floor($this->intMeetingEndTime / 100), $this->intMeetingEndTime % 100, 0);
                 return sprintf('%ss, %s to %s', $strArray[$this->intMeetingDay], $dttStart->ToString('h:mmz'), $dttEnd->ToString('h:mmz'));
             } else {
                 return 'TBA';
             }
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:25,代码来源:ClassMeeting.class.php

示例3: GenerateStewardship

 public static function GenerateStewardship()
 {
     $dttDate = new QDateTime('2004-01-05');
     print 'Generating Stewardship... ';
     $objFundArray = StewardshipFund::QueryArray(QQ::NotEqual(QQN::StewardshipFund()->Id, 1));
     while ($dttDate->IsEarlierThan(QDateTime::Now())) {
         print $strDate = '[' . $dttDate->ToString('YYYY-MMM-DD') . ']';
         $intCheckCount = rand(10, 55);
         $arrStack = array();
         for ($i = 0; $i < floor(($intCheckCount - 1) / 25) + 1; $i++) {
             $arrStack[] = null;
         }
         $objBatch = StewardshipBatch::Create(self::GenerateFromArray(self::$StewardshipUserArray), $arrStack, self::GenerateFromArray(array('Weekend T/O', 'Weekend Giving', 'Tithes and Offerings', 'Tithes & Offerings', null)), $dttDate, $dttDate);
         $intStackCount = $objBatch->CountStewardshipStacks();
         $dttStart = new QDateTime($dttDate);
         $dttStart->SetTime(8, 0, 0);
         $dttEnd = new QDateTime($dttDate);
         $dttEnd->SetTime(16, 0, 0);
         for ($i = 0; $i < $intStackCount; $i++) {
             if ($i == $intStackCount - 1) {
                 if ($intCheckCount % 25 == 0) {
                     $intChecksInStackCount = 25;
                 } else {
                     $intChecksInStackCount = $intCheckCount % 25;
                 }
             } else {
                 $intChecksInStackCount = 25;
             }
             $objStack = StewardshipStack::LoadByStewardshipBatchIdStackNumber($objBatch->Id, $i + 1);
             for ($j = 0; $j < $intChecksInStackCount; $j++) {
                 $objHousehold = self::GenerateFromArray(self::$HouseholdArray);
                 $objHouseholdParticipant = self::GenerateFromArray($objHousehold->GetHouseholdParticipationArray());
                 $mixAmountArray = array();
                 if (rand(0, 50)) {
                     $mixAmountArray[] = array(1, rand(1000, 150000) / 100);
                 } else {
                     $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
                 }
                 if (!rand(0, 20)) {
                     $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
                 }
                 $objContribution = StewardshipContribution::Create($objBatch->CreatedByLogin, $objHouseholdParticipant->Person, $objStack, StewardshipContributionType::Check, rand(1000, 9999), $mixAmountArray, self::GenerateDateTime($dttStart, $dttEnd), null, null, null, false);
                 if (rand(0, 5)) {
                     $objContribution->SaveImageFile(__DEVTOOLS_CLI__ . '/datagen_file_assets/check.tif');
                 }
             }
             $objStack->RefreshActualTotalAmount();
         }
         if ($intCheckCount != $objBatch->CountStewardshipContributions()) {
             print "\r\n" . 'MISCOUNT: ' . $objBatch->Id . "\r\n";
         }
         $objBatch->RefreshActualTotalAmount();
         $dttDate->Day += 7;
         print str_repeat(chr(8) . ' ' . chr(8), strlen($strDate));
     }
     print "Done.\r\n";
 }
开发者ID:alcf,项目名称:chms,代码行数:57,代码来源:datagen.cli.php

示例4: GetReportYtdByFundForMonth

 /**
  * Returns an array of 2-item arrays, where each item has the following index:
  * 	0: stewardship_fund_id
  * 	1; total amount YTD
  * for a given month
  * @param QDateTime $dttMonth
  * @return string[][]
  */
 public static function GetReportYtdByFundForMonth(QDateTime $dttMonth)
 {
     $dttMonth->Day = 1;
     $dttMonth->SetTime(null, null, null);
     $dttNextMonth = new QDateTime($dttMonth);
     $dttNextMonth->Month++;
     $dttNextMonth->SetTime(null, null, null);
     $dttMonth->Month = 1;
     $objResult = StewardshipPostAmount::GetDatabase()->Query(sprintf("SELECT stewardship_fund_id, SUM(amount) AS sum_amount FROM stewardship_post_amount, stewardship_post, stewardship_batch WHERE\n\t\t\t\tstewardship_batch_id=stewardship_batch.id AND\n\t\t\t\tstewardship_post_id=stewardship_post.id AND date_credited >= '%s' AND date_credited < '%s' GROUP BY stewardship_fund_id ORDER BY SUM(amount) DESC;", $dttMonth->ToString('YYYY-MM-DD'), $dttNextMonth->ToString('YYYY-MM-DD')));
     $strToReturn = array();
     while ($objRow = $objResult->GetNextRow()) {
         $strToReturn[] = array($objRow->GetColumn('stewardship_fund_id'), $objRow->GetColumn('sum_amount'));
     }
     return $strToReturn;
 }
开发者ID:alcf,项目名称:chms,代码行数:23,代码来源:StewardshipPost.class.php

示例5: Form_Create

 protected function Form_Create()
 {
     $this->lstYear = new QListBox($this);
     for ($intYear = 2002; $intYear <= date('Y'); $intYear++) {
         $this->lstYear->AddItem($intYear, $intYear, QApplication::PathInfo(0) ? QApplication::PathInfo(0) == $intYear : $intYear == QDateTime::Now()->Year);
     }
     $this->lstMonth = new QListBox($this);
     for ($intMonth = 1; $intMonth <= 12; $intMonth++) {
         $dttDate = new QDateTime('2000-' . $intMonth . '-01');
         $this->lstMonth->AddItem($dttDate->ToString('MMMM'), $intMonth, QApplication::PathInfo(1) ? QApplication::PathInfo(1) == $intMonth : $intMonth == QDateTime::Now()->Month);
     }
     $this->lstYear->AddAction(new QChangeEvent(), new QAjaxAction('lstDate_Change'));
     $this->lstMonth->AddAction(new QChangeEvent(), new QAjaxAction('lstDate_Change'));
     $this->dtgReport = new QDataGrid($this);
     $this->dtgReport->AddColumn(new QDataGridColumn('Fund', '<?= $_FORM->RenderRow($_ITEM); ?><?= StewardshipFund::Load($_ITEM[0])->Name; ?>', 'Width=400px'));
     $this->dtgReport->AddColumn(new QDataGridColumn('Monthly Total', '<?= QApplication::DisplayCurrency($_ITEM[1]); ?>', 'Width=400px'));
     $this->dtgReport->AddColumn(new QDataGridColumn('YTD', '<?= QApplication::DisplayCurrency($_ITEM[2]); ?>', 'Width=400px'));
     $this->dttDate = new QDateTime($this->lstYear->SelectedValue . '-' . $this->lstMonth->SelectedValue . '-01');
     $this->dttDate->SetTime(null, null, null);
     // Get the Data
     $objReportArray = StewardshipPost::GetReportByFundAndMonth($this->dttDate);
     $objReportYtdArray = StewardshipPost::GetReportYtdByFundForMonth($this->dttDate);
     // Setup the data holders
     $this->fltTotal = 0;
     $this->fltTotalYtd = 0;
     $objArray = array();
     foreach ($objReportArray as $objLineItem) {
         $objFund = StewardshipFund::Load($objLineItem[0]);
         if ($objFund->AccountNumber == '7011.010' || substr($objFund->AccountNumber, 0, 1) == '4') {
             $this->fltTotal += $objLineItem[1];
             $objArray[$objLineItem[0]] = array($objLineItem[0], $objLineItem[1], null);
         }
     }
     foreach ($objReportYtdArray as $objLineItem) {
         $objFund = StewardshipFund::Load($objLineItem[0]);
         if ($objFund->AccountNumber == '7011.010' || substr($objFund->AccountNumber, 0, 1) == '4') {
             $this->fltTotalYtd += $objLineItem[1];
             if (array_key_exists($objLineItem[0], $objArray)) {
                 $objArray[$objLineItem[0]][2] = $objLineItem[1];
             } else {
                 $objArray[$objLineItem[0]] = array($objLineItem[0], null, $objLineItem[1]);
             }
         }
     }
     // Bind the data
     $this->dtgReport->DataSource = $objArray;
 }
开发者ID:alcf,项目名称:chms,代码行数:47,代码来源:monthly_giving.php

示例6: GetControlHtml

 protected function GetControlHtml()
 {
     // Ignore Class
     $strCssClass = $this->strCssClass;
     $this->strCssClass = '';
     $strAttributes = $this->GetAttributes();
     $this->strCssClass = $strCssClass;
     $strStyle = $this->GetStyleAttributes();
     if ($strStyle) {
         $strAttributes .= sprintf(' style="%s"', $strStyle);
     }
     $strCommand = sprintf(' onchange="Qcodo__DateTimePicker_Change(\'%s\', this);"', $this->strControlId);
     if ($this->dttDateTime) {
         $dttDateTime = $this->dttDateTime;
     } else {
         $dttDateTime = new QDateTime();
     }
     $strToReturn = '';
     // Generate Date-portion
     switch ($this->strDateTimePickerType) {
         case QDateTimePickerType::Date:
         case QDateTimePickerType::DateTime:
         case QDateTimePickerType::DateTimeSeconds:
             // Month
             $strMonthListbox = sprintf('<select name="%s_lstMonth" id="%s_lstMonth" class="month" %s%s>', $this->strControlId, $this->strControlId, $strAttributes, $strCommand);
             if (!$this->blnRequired || $dttDateTime->IsDateNull()) {
                 $strMonthListbox .= '<option value="">--</option>';
             }
             $dttMonth = new QDateTime('2000-01-01');
             for ($intMonth = 1; $intMonth <= 12; $intMonth++) {
                 if (!$dttDateTime->IsDateNull() && $dttDateTime->Month == $intMonth || $this->intSelectedMonth == $intMonth) {
                     $strSelected = ' selected="selected"';
                 } else {
                     $strSelected = '';
                 }
                 $dttMonth->Month = $intMonth;
                 $strMonthListbox .= sprintf('<option value="%s"%s>%s</option>', $intMonth, $strSelected, $dttMonth->ToString('MMM'));
             }
             $strMonthListbox .= '</select>';
             // Day
             $strDayListbox = sprintf('<select name="%s_lstDay" id="%s_lstDay" class="day" %s%s>', $this->strControlId, $this->strControlId, $strAttributes, $strCommand);
             if (!$this->blnRequired || $dttDateTime->IsDateNull()) {
                 $strDayListbox .= '<option value="">--</option>';
             }
             if ($dttDateTime->IsDateNull()) {
                 if ($this->blnRequired) {
                     // New DateTime, but we are required -- therefore, let's assume January is preselected
                     for ($intDay = 1; $intDay <= 31; $intDay++) {
                         $strDayListbox .= sprintf('<option value="%s">%s</option>', $intDay, $intDay);
                     }
                 } else {
                     // New DateTime -- but we are NOT required
                     // See if a month has been selected yet.
                     if ($this->intSelectedMonth) {
                         $intSelectedYear = $this->intSelectedYear ? $this->intSelectedYear : 2000;
                         $intDaysInMonth = date('t', mktime(0, 0, 0, $this->intSelectedMonth, 1, $intSelectedYear));
                         for ($intDay = 1; $intDay <= $intDaysInMonth; $intDay++) {
                             if ($dttDateTime->Day == $intDay || $this->intSelectedDay == $intDay) {
                                 $strSelected = ' selected="selected"';
                             } else {
                                 $strSelected = '';
                             }
                             $strDayListbox .= sprintf('<option value="%s"%s>%s</option>', $intDay, $strSelected, $intDay);
                         }
                     } else {
                         // It's ok just to have the "--" marks and nothing else
                     }
                 }
             } else {
                 $intDaysInMonth = $dttDateTime->PHPDate('t');
                 for ($intDay = 1; $intDay <= $intDaysInMonth; $intDay++) {
                     if ($dttDateTime->Day == $intDay || $this->intSelectedDay == $intDay) {
                         $strSelected = ' selected="selected"';
                     } else {
                         $strSelected = '';
                     }
                     $strDayListbox .= sprintf('<option value="%s"%s>%s</option>', $intDay, $strSelected, $intDay);
                 }
             }
             $strDayListbox .= '</select>';
             // Year
             $strYearListbox = sprintf('<select name="%s_lstYear" id="%s_lstYear" class="year" %s%s>', $this->strControlId, $this->strControlId, $strAttributes, $strCommand);
             if (!$this->blnRequired || $dttDateTime->IsDateNull()) {
                 $strYearListbox .= '<option value="">--</option>';
             }
             for ($intYear = $this->intMinimumYear; $intYear <= $this->intMaximumYear; $intYear++) {
                 if ($dttDateTime->Year == $intYear || $this->intSelectedYear == $intYear) {
                     $strSelected = ' selected="selected"';
                 } else {
                     $strSelected = '';
                 }
                 $strYearListbox .= sprintf('<option value="%s"%s>%s</option>', $intYear, $strSelected, $intYear);
             }
             $strYearListbox .= '</select>';
             // Put it all together
             switch ($this->strDateTimePickerFormat) {
                 case QDateTimePickerFormat::MonthDayYear:
                     $strToReturn .= $strMonthListbox . $strDayListbox . $strYearListbox;
                     break;
                 case QDateTimePickerFormat::DayMonthYear:
//.........这里部分代码省略.........
开发者ID:snowmann,项目名称:qcodo,代码行数:101,代码来源:QDateTimePicker.class.php

示例7: CalculateMessageHeaderAndBody

 /**
  * Given the way this object is set up, it will return two-index string array containing the correct
  * SMTP Message Header and Message Body for this object.
  * 
  * This will make changes, cleanup and any additional setup to the HeaderArray in order to complete its task
  * 
  * @param string $strEncodingType the encoding type to use (if null, then it uses QApplication's)
  * @param QDateTime $dttSendDate the optional QDateTime to use for the Date field or NULL if you want to use Now()
  * @return string[] index 0 is the Header and index 1 is the Body
  */
 public function CalculateMessageHeaderAndBody($strEncodingType = null, QDateTime $dttSendDate = null)
 {
     // Setup Headers
     $this->RemoveHeader('Message-Id');
     $this->SetHeader('From', $this->From);
     $this->SetHeader('To', $this->To);
     if ($dttSendDate) {
         $this->SetHeader('Date', $dttSendDate->ToString(QDateTime::FormatRfc822));
     } else {
         $this->SetHeader('Date', QDateTime::NowToString(QDateTime::FormatRfc822));
     }
     // Setup Encoding Type (default to QApplication's if not specified)
     if (!$strEncodingType) {
         $strEncodingType = QApplication::$EncodingType;
     }
     // Additional "Optional" Headers
     if ($this->Subject) {
         $strSubject = self::QuotedPrintableEncode($this->Subject);
         $strSubject = str_replace('?', '=3F', $strSubject);
         $this->SetHeader('Subject', sprintf("=?%s?Q?%s?=", $strEncodingType, $strSubject));
     }
     if ($this->Cc) {
         $this->SetHeader('Cc', $this->Cc);
     }
     // Setup for MIME and Content Encoding
     $strBoundaryArray = $this->SetupMimeHeaders($strEncodingType);
     $strBoundary = $strBoundaryArray[0];
     $strAltBoundary = $strBoundaryArray[1];
     // Generate MessageHeader
     $strHeader = $this->CalculateMessageHeader();
     // Generate MessageBody
     $strBody = $this->CalculateMessageBody($strEncodingType, $strBoundary, $strAltBoundary);
     return array($strHeader, $strBody);
 }
开发者ID:harshanurodh,项目名称:qcodo,代码行数:44,代码来源:QEmailServer.class.php

示例8: NowToString

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

示例9: array

            $strImageHtml = '<img style="float: left; margin-top: 5px; margin-right: 5px;" src="' . $strUrl . '"/>';
        } else {
            $strImageHtml = null;
        }
        $strAuthor = null;
        // Try and deduce an author if applicable
        $arrMatches = array();
        if (preg_match('/([bByY][ A-Za-z\\-\']*)(\\[[A-Za-z0-9 \\/.,\\-_]*\\])/', $strDescription, $arrMatches)) {
            $strAuthor = trim($arrMatches[1]);
            $strDateTime = trim($arrMatches[2]);
            $strDescription = trim(substr($strDescription, strlen($arrMatches[0])));
        }
        if ($strAuthor) {
            $strHtml = sprintf('<div style="cursor: pointer;" onclick="document.location=&quot;%s&quot;;"><h1 style="font-size: 18px;">Featured Article</h1>%s<strong>%s</strong><br/><em>%s<br/>%s</em><br/>%s<br/><a href="%s" onclick="return false;">Read More</a></div>', QApplication::HtmlEntities($strLink), $strImageHtml, $strTitle, $strAuthor, $strDateTime, QString::Truncate($strDescription, 100), QApplication::HtmlEntities($strLink));
        } else {
            $strHtml = sprintf('<div style="cursor: pointer;" onclick="document.location=&quot;%s&quot;;"><h1 style="font-size: 18px;">Featured Article</h1>%s<strong>%s</strong><br/><em>%s</em><br/>%s<br/><a href="%s" onclick="return false;">Read More</a></div>', QApplication::HtmlEntities($strLink), $strImageHtml, $strTitle, $dttDateTime->ToString('MMMM D, YYYY'), QString::Truncate($strDescription, 100), QApplication::HtmlEntities($strLink));
        }
        $strHtmlArray[] = $strHtml;
    }
}
///////////////////////
// Setup the JS/HTML (if applicable)
///////////////////////
if (count($strHtmlArray)) {
    $strHtml = implode('<br/><br/>', $strHtmlArray);
    $strHtml = '<img src="/uploads/mediaHeader.png" title="Abundant Living Online" style="position: relative; top: -15px; left: -10px; cursor: pointer;" onclick="document.location=&quot;http://abundantliving.alcf.net/&quot;" /><br/>' . $strHtml;
    $strHtml = str_replace('"', '\\"', $strHtml);
    if (!is_dir(dirname(SYNDICATION_CACHE_PATH))) {
        QApplication::MakeDirectory(dirname(SYNDICATION_CACHE_PATH), 0777);
    }
    file_put_contents(SYNDICATION_CACHE_PATH, 'document.getElementById("syndicatedContent").innerHTML = "' . $strHtml . '";');
开发者ID:alcf,项目名称:chms,代码行数:31,代码来源:syndication.php


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