本文整理汇总了PHP中DateTimeUtils::GetDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtils::GetDateTime方法的具体用法?PHP DateTimeUtils::GetDateTime怎么用?PHP DateTimeUtils::GetDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeUtils
的用法示例。
在下文中一共展示了DateTimeUtils::GetDateTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
$lineItemService = $user->GetService('LineItemService', 'v201311');
// Set the ID of the order to get line items from.
$orderId = 'INSERT_ORDER_ID_HERE';
// Calculate time from three days ago.
$threeDaysAgo = date(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT, strtotime('-3 day'));
// Create bind variables.
$vars = MapUtils::GetMapEntries(array('orderId' => new NumberValue($orderId), 'threeDaysAgo' => new TextValue($threeDaysAgo)));
// Create statement object to only select line items belonging to the order
// and have been modified in the last 3 days.
$filterStatement = new Statement("WHERE orderId = :orderId " . "AND lastModifiedDateTime >= :threeDaysAgo " . "LIMIT 500", $vars);
// Get line items by statement.
$page = $lineItemService->getLineItemsByStatement($filterStatement);
// Display results.
if (isset($page->results)) {
$i = $page->startIndex;
foreach ($page->results as $lineItem) {
// Format lastModifiedDateTime for printing.
$lastModifiedDateTime = DateTimeUtils::GetDateTime($lineItem->lastModifiedDateTime);
$lastModifiedDateTimeText = $lastModifiedDateTime->format(DateTimeUtils::$DFP_DATE_TIME_STRING_FORMAT);
print $i . ') Line item with ID "' . $lineItem->id . '", belonging to order ID "' . $lineItem->orderId . '", with name "' . $lineItem->name . '", and last modified ' . $lastModifiedDateTimeText . " was found.\n";
$i++;
}
}
print 'Number of results found: ' . $page->totalResultSetSize . "\n";
} catch (OAuth2Exception $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (ValidationException $e) {
ExampleUtils::CheckForOAuth2Errors($e);
} catch (Exception $e) {
print $e->getMessage() . "\n";
}