本文整理汇总了PHP中QDateTime::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP QDateTime::__toString方法的具体用法?PHP QDateTime::__toString怎么用?PHP QDateTime::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTime
的用法示例。
在下文中一共展示了QDateTime::__toString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calculateValues
function calculateValues(Group $objGroup)
{
global $startDate;
global $endDate;
//global $tempDate;
global $objPersonArray;
global $monthCount;
$objGroupParticipationArray = $objGroup->GetGroupParticipationArray();
foreach ($objGroupParticipationArray as $objParticipation) {
// If role is Volunteer or Volunteer Leader
if ($objParticipation->GroupRole->GroupRoleTypeId == 1 || $objParticipation->GroupRole->GroupRoleTypeId == 3) {
// If a volunteer, then instantiate arrays
$tempDate = new QDateTime($startDate);
while ($tempDate->IsEarlierOrEqualTo($endDate)) {
if ($objParticipation->DateStart < $tempDate && ($objParticipation->DateEnd > $tempDate || $objParticipation->DateEnd == null)) {
// Verify unique person each time
if (!in_array($objParticipation->PersonId, $objPersonArray[$tempDate->__toString('MMM YYYY')])) {
$objPersonArray[$tempDate->__toString('MMM YYYY')][] = $objParticipation->PersonId;
$monthCount[$tempDate->__toString('MMM YYYY')]++;
}
}
$tempDate->AddMonths(1);
}
}
}
}
示例2: Q
public static function Q(QDateTime $objQDateTime)
{
if ($objQDateTime->IsTimeNull()) {
//error_log("NotNUll: " . sprintf("'%s'", $objQDateTime->__toString('YYYY-MM-DD')));
return $objQDateTime->__toString('YYYY-MM-DD');
} else {
//error_log("IS NULL: " . sprintf("'%s'", $objQDateTime->__toString(QDateTime::FormatIso)));
return $objQDateTime->__toString(QDateTime::FormatIso);
}
}
示例3: RefreshGitData
function RefreshGitData($strRepository, $strRegistryName)
{
$strXml = file_get_contents('https://github.com/qcodo/' . $strRepository . '/commits/master.atom');
$objXml = new SimpleXMLElement($strXml);
$objMostRecentCommit = $objXml->entry[0];
$dttCommit = new QDateTime((string) $objMostRecentCommit->updated);
$strMessage = trim((string) $objMostRecentCommit->title);
$strDate = $dttCommit->__toString('DDDD, MMMM D, YYYY');
$strUrl = (string) $objMostRecentCommit->link['href'];
// Cleanup Message
if (($intPosition = strpos($strMessage, "\n")) !== false) {
$strMessage = trim(substr($strMessage, 0, $intPosition));
}
Registry::SetValue('gitinfo_' . $strRegistryName . '_message', $strMessage);
Registry::SetValue('gitinfo_' . $strRegistryName . '_date', $strDate);
Registry::SetValue('gitinfo_' . $strRegistryName . '_url', $strUrl);
}
示例4: RefreshGitData
function RefreshGitData($strRepository, $strRegistryName)
{
$strXml = file_get_contents('http://github.com/api/v2/xml/commits/list/qcodo/' . $strRepository . '/master');
$objXml = new SimpleXMLElement($strXml);
$objMostRecentCommit = $objXml->commit[0];
$strNodeName = 'committed-date';
$dttCommit = new QDateTime((string) $objMostRecentCommit->{$strNodeName});
$strMessage = trim((string) $objMostRecentCommit->message);
$strDate = $dttCommit->__toString('DDDD, MMMM D, YYYY');
$strUrl = (string) $objMostRecentCommit->url;
// Cleanup Message
if (($intPosition = strpos($strMessage, "\n")) !== false) {
$strMessage = trim(substr($strMessage, 0, $intPosition));
}
Registry::SetValue('gitinfo_' . $strRegistryName . '_message', $strMessage);
Registry::SetValue('gitinfo_' . $strRegistryName . '_date', $strDate);
Registry::SetValue('gitinfo_' . $strRegistryName . '_url', $strUrl);
}
示例5: NowToString
/**
* Shortcut to output the current datetime in any defined format. Follows the same
* formatting mechanism as __toString. This is basically a shortcut to doing:
* $dttNow = new QDateTime(QDateTime::Now);
* $dttNow->__toString($strFormat);
*
* @param string $strFormat the format of the datetime
* @return string the formatted current datetime as a string
*/
public static function NowToString($strFormat = null)
{
if (is_null($strFormat)) {
$strFormat = QDateTime::$DefaultFormat;
}
$dttNow = new QDateTime(QDateTime::Now);
return $dttNow->__toString($strFormat);
}
示例6: NowToString
public static function NowToString($strFormat = null)
{
$dttNow = new QDateTime(QDateTime::Now);
return $dttNow->__toString($strFormat);
}
示例7: QDateTime
Using <b>$blnForceUpdate</b> to avoid the <b>Optimistic Locking Exception</b><br/>
<input type="submit" id="double_force" name="double_force" value="Force Update Second Object"/><br/><br/><br/>
</div></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->__toString(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);
示例8: colDate_Render
public function colDate_Render(SimpleXmlElement $objErrorXml)
{
$dttDate = new QDateTime($objErrorXml->isoDateTime);
return $dttDate->__toString('MMM D') . '<br/><span class="meta">' . $dttDate->__toString('h:mm:ss z') . '</span>';
}
示例9: DisplayTimezoneLink
/**
* Displays the timezone of a given datetime WITH a link to the user's "Edit Profile" page (to update
* his/her timezone preferences) if the user is logged in.
* @param QDateTime $dttDateTime
* @param boolean $blnDisplayOutput whether or not to print the actual output, or just return it
* @return string the html to be outputted
*/
public static function DisplayTimezoneLink(QDateTime $dttDateTime, $blnDisplayOutput = true)
{
if ($dttDateTime) {
if (QApplication::$Person) {
$strToReturn = '<a href="/profile/edit.php" title="update timezone settings">' . $dttDateTime->__toString('ttt') . '</a>';
} else {
$strToReturn = $dttDateTime->__toString('ttt');
}
} else {
$strToReturn = '';
}
if ($blnDisplayOutput) {
print $strToReturn;
}
return $strToReturn;
}