本文整理汇总了PHP中QDateTime::FromTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP QDateTime::FromTimestamp方法的具体用法?PHP QDateTime::FromTimestamp怎么用?PHP QDateTime::FromTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTime
的用法示例。
在下文中一共展示了QDateTime::FromTimestamp方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_object
/**
* @param DleUsers $objDleUsers The DB ORM object to process
*/
protected function process_object($objDleUsers)
{
// wp: ID, user_login, user_nicename, user_email, user_registered, display_name
// dl: user_id, name, name, email, FROM_UNIXTIME( reg_date ), fullname
$strEmail = $objDleUsers->Email;
if ($strEmail && strlen($strEmail)) {
// check if already copied
if (!WpUsers::QueryCount(QQ::Equal(QQN::WpUsers()->UserEmail, $strEmail))) {
$objWpUsers = new WpUsers();
$objWpUsers->Initialize();
// set defaults
$objWpUsers->UserLogin = $objDleUsers->Name;
$objWpUsers->UserNicename = $objDleUsers->Name;
$objWpUsers->UserEmail = $objDleUsers->Email;
$objWpUsers->UserRegistered = QDateTime::FromTimestamp(intval($objDleUsers->RegDate));
$objWpUsers->DisplayName = $objDleUsers->Fullname;
$objWpUsers->UserPass = '';
$objWpUsers->UserUrl = '';
$objWpUsers->UserActivationKey = '';
$objWpUsers->UserStatus = 0;
$objWpUsers->Save();
$this->intUserCount++;
}
}
}
示例2: testRoundtrip
public function testRoundtrip()
{
$obj1 = QDateTime::Now();
$obj2 = QDateTime::FromTimestamp($obj1->Timestamp);
$this->assertTrue($obj1->IsEqualTo($obj2));
}
示例3: DueDate_Create
protected function DueDate_Create()
{
$this->lstDueDate = new QRadioButtonList($this);
$this->lstDueDate->AddItem(new QListItem('No due date', 1, false, null, 'FontSize=12px'));
$this->lstDueDate->AddItem(new QListItem('Due Date:', 2, false, null, 'FontSize=12px'));
$this->lstDueDate->SelectedIndex = 0;
$this->lstDueDate->AddAction(new QChangeEvent(), new QAjaxAction('lstDueDate_Select'));
$this->dttDueDate = new QDateTimePickerExt($this);
$this->dttDueDate->DateTimePickerType = QDateTimePickerType::DateTime;
$this->dttDueDate->Display = false;
$dttNow = QDateTime::Now();
$this->dttDueDate->MinimumYear = $dttNow->Year;
$this->dttDueDate->__set('DateTime', QDateTime::FromTimestamp($dttNow->Timestamp + intval(QApplication::$TracmorSettings->DefaultCheckOutPeriod) * 3600));
$this->dttDueDate->MaximumYear = $dttNow->Year + 1;
if (QApplication::$TracmorSettings->DueDateRequired == "1") {
$this->dttDueDate->Display = true;
$this->lstDueDate->SelectedIndex = 1;
}
}
示例4: calShipDate_Create
protected function calShipDate_Create()
{
$this->calShipDate = new QDateTimePickerExt($this);
$this->calShipDate->Name = QApplication::Translate('Ship Date');
$this->calShipDate->DateTimePickerType = QDateTimePickerType::Date;
if ($this->blnEditMode) {
$this->calShipDate->DateTime = $this->objShipment->ShipDate;
} elseif (!$this->blnEditMode) {
$this->calShipDate->DateTime = new QDateTime(QDateTime::Now);
}
$this->calShipDate->Required = true;
$this->dttNow = new QDateTime(QDateTime::Now);
// $this->calShipDate->MinimumYear = $this->dttNow->Year;
// $this->calShipDate->MinimumMonth = $this->dttNow->Month;
// $this->calShipDate->MinimumDay = $this->dttNow->Day;
// 5 Days: 432000
// 6 Days: 518400
// 7 Days: 604800
// 10 Days: 864000
// 200 Days: 17280000
$intDayOfWeek = date('w', time());
// Sunday - just add five days
if ($intDayOfWeek == 0) {
$this->dttFiveDaysFromNow = QDateTime::FromTimestamp($this->dttNow->Timestamp + 432000);
// new QDateTime($this->dttNow->Timestamp + 432000);
} elseif ($intDayOfWeek > 0 && $intDayOfWeek < 6) {
$this->dttFiveDaysFromNow = QDateTime::FromTimestamp($this->dttNow->Timestamp + 604800);
//new QDateTime($this->dttNow->Timestamp + 604800);
} elseif ($intDayOfWeek == 6) {
$this->dttFiveDaysFromNow = QDateTime::FromTimestamp($this->dttNow->Timestamp + 518400);
//new QDateTime($this->dttNow->Timestamp + 518400);
}
$this->calShipDate->MaximumYear = $this->dttFiveDaysFromNow->Year;
$this->calShipDate->MaximumMonth = $this->dttFiveDaysFromNow->Month;
$this->calShipDate->MaximumDay = $this->dttFiveDaysFromNow->Day;
$this->calShipDate->AddAction(new QChangeEvent(), new QAjaxAction('calShipDate_Select'));
QApplication::ExecuteJavaScript(sprintf("document.getElementById('%s').focus()", $this->calShipDate->ControlId));
$this->calShipDate->TabIndex = 10;
}
示例5: foreach
$this->btnGenerateQuarterly->Render('CssClass=primary');
?>
for
<?php
$this->lstQuarter->Render();
?>
</div>
<?php
$this->lstYear->RenderWithName();
?>
</div>
<?php
for ($intYear = 2000; $intYear <= date('Y') + 1; $intYear++) {
if (count($strFileArray = $this->GetFileArrayForYear($intYear))) {
print '<h3>Bulk Receipt PDFs for ' . $intYear . '</h3>';
print '<div class="section">';
print '<div class="sectionButtons"><button class="primary"';
$this->pxyDelete->RenderAsEvents($intYear);
print '>Delete Receipts for ' . $intYear . '</button></div>';
print '<ul style="font-family: arial, helvetica, sans-serif; font-size: 12px;">';
foreach ($strFileArray as $strFile) {
printf('<li style="margin: 5px 0;"><strong><a href="/stewardship/receipts/download.php/%s">%s</a></strong> <span style="font-size: 10px; color: #666;">%s | %s</span></li>', QApplication::HtmlEntities($strFile), QApplication::HtmlEntities($strFile), QDateTime::FromTimestamp(filectime(RECEIPT_PDF_PATH . '/' . $strFile))->ToString('MMM D YYYY, h:mm z'), QString::GetByteSize(filesize(RECEIPT_PDF_PATH . '/' . $strFile)));
}
print '</ul></div>';
}
}
?>
<?php
require __INCLUDES__ . '/footer.inc.php';
示例6: __get
public function __get($strName)
{
switch ($strName) {
// MISC
case "DateTime":
if ($this->intTimestamp) {
$dttToReturn = QDateTime::FromTimestamp($this->intTimestamp);
$dttToReturn->SetTime(null, null, null);
return $dttToReturn;
} else {
return null;
}
case "CalendarType":
return $this->strCalendarType;
// case "MinimumDate": return $this->dttMinimumDate;
// case "MaximumDate": return $this->dttMaximumDate;
// case "MinimumDate": return $this->dttMinimumDate;
// case "MaximumDate": return $this->dttMaximumDate;
default:
try {
return parent::__get($strName);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}
示例7: GetQcodoVersionDate
/**
* @return QDateTime
*/
public static function GetQcodoVersionDate($blnStableVersion = true)
{
$strVersion = QApplication::GetQcodoVersion($blnStableVersion);
if ($strVersion) {
return QDateTime::FromTimestamp(filemtime(__QCODO_BUILDS__ . '/qcodo-' . $strVersion . '.tar.gz'));
}
}
示例8: GenerateDateTime
/**
* Generates a random QDateTime given the range of $dttStart and $dttEnd
* @param QDateTime $dttStart the start date for the range
* @param QDateTime $dttEnd the end date for the range
* @return QDateTime
*/
public static function GenerateDateTime(QDateTime $dttStart, QDateTime $dttEnd)
{
$intStart = $dttStart->Timestamp;
$intEnd = $dttEnd->Timestamp;
$intRand = rand($intStart, $intEnd);
return QDateTime::FromTimestamp($intRand);
}
示例9: LoadArrayBySearchResultArray
/**
* Given an ordered ID Array and Limit information, this will return
* an array of Topics
* @param Zend_Search_Lucene_Search_QueryHit[] $objQueryHitArray
* @param string $strLimitInfo
* @return Topic[]
*/
public static function LoadArrayBySearchResultArray($objQueryHitArray, $strLimitInfo)
{
// Calculate Offset and ItemsPerPage
$strTokens = explode(',', $strLimitInfo);
$intOffset = intval($strTokens[0]);
$intItemsPerPage = intval($strTokens[1]);
// Perform the Offset and LImit
$objQueryHitArray = array_slice($objQueryHitArray, $intOffset, $intItemsPerPage);
$objTopicArray = array();
foreach ($objQueryHitArray as $objHit) {
$objTopic = new Topic();
$objTopic->intId = $objHit->db_id;
$objTopic->intTopicLinkId = $objHit->topic_link_id;
$objTopic->strName = $objHit->title;
$objTopic->dttLastPostDate = QDateTime::FromTimestamp($objHit->last_post_date);
$objTopic->intMessageCount = $objHit->message_count;
$objTopicArray[] = $objTopic;
}
return $objTopicArray;
}
示例10: __get
public function __get($strName)
{
switch ($strName) {
// MISC
case "DateTime":
if ($this->intTimestamp) {
$dttToReturn = QDateTime::FromTimestamp($this->intTimestamp);
switch ($this->strCalendarType) {
case QCalendarType::DateOnly:
$dttToReturn->SetTime(null, null, null);
break;
case QCalendarType::DateTime:
$dttToReturn->SetTime($dttToReturn->Hour, $dttToReturn->Minute, null);
break;
case QCalendarType::TimeOnly:
$dttToReturn->SetDate(null, null, null);
$dttToReturn->SetTime($dttToReturn->Hour, $dttToReturn->Minute, null);
break;
case QCalendarType::DateTimeSeconds:
$dttToReturn->SetTime($dttToReturn->Hour, $dttToReturn->Minute, $dttToReturn->Second);
break;
case QCalendarType::TimeSecondsOnly:
$dttToReturn->SetDate(null, null, null);
$dttToReturn->SetTime(null, null, $dttToReturn->Second);
break;
}
return $dttToReturn;
} else {
return null;
}
case "CalendarType":
return $this->strCalendarType;
// case "MinimumDate": return $this->dttMinimumDate;
// case "MaximumDate": return $this->dttMaximumDate;
// case "MinimumDate": return $this->dttMinimumDate;
// case "MaximumDate": return $this->dttMaximumDate;
default:
try {
return parent::__get($strName);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}
示例11: foreach
<?php
$objPersonCursor = Person::QueryCursor(QQ::All());
//QDataGen::DisplayForEachTaskStart('Checking for Members who might have left', Person::CountAll());
print "\n";
$iTotal = 0;
$yearBack = QDateTime::FromTimestamp(strtotime("1 February 2014"));
print "YearBack = " . $yearBack . "\n";
while ($objPerson = Person::InstantiateCursor($objPersonCursor)) {
//QDataGen::DisplayForEachTaskNext('Checking for Members who might have left');
if ($objPerson->MembershipStatusTypeId == MembershipStatusType::Member) {
$stewardshipArray = $objPerson->GetStewardshipContributionArray();
$isMember = false;
foreach ($stewardshipArray as $objStewardship) {
//$temp = new StewardshipContribution();
//$temp-> QDateTime
if ($objStewardship->DateEntered > $yearBack) {
$isMember = true;
}
//print "Stewardship Date Entered = ". $objStewardship->DateEntered ."\n";
}
if (!$isMember) {
if ($objPerson->PublicLogin == null) {
print $objPerson->FirstName . ' ' . $objPerson->LastName . ' might not be a member..';
print "\n";
$iTotal++;
}
}
}
}
//DataGen::DisplayForEachTaskEnd('Checking for Members who might have left');
示例12: __get
public function __get($strName)
{
switch ($strName) {
case 'Date':
return QDateTime::FromTimestamp($this->strDate);
default:
try {
return parent::__get($strName);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}