本文整理汇总了PHP中DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent方法的具体用法?PHP DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent怎么用?PHP DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseCompatibilityUtil
的用法示例。
在下文中一共展示了DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolveTimeZoneAdjustmentForACalculatedDateTimeModifier
/**
* @param string $attribute
* @return string
*/
protected function resolveTimeZoneAdjustmentForACalculatedDateTimeModifier($attribute)
{
$resolvedAttribute = $this->modelToReportAdapter->resolveRealAttributeName($attribute);
if ($this->modelToReportAdapter->getRealModelAttributeType($resolvedAttribute) == 'DateTime') {
return DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent();
}
}
示例2: resolveTimeZoneAdjustmentForACalculatedDateTimeModifier
/**
* @return string
*/
protected function resolveTimeZoneAdjustmentForACalculatedDateTimeModifier()
{
$attributeType = ModelAttributeToMixedTypeUtil::getType($this->modelAttributeToDataProviderAdapter->getModel(), $this->modelAttributeToDataProviderAdapter->getAttribute());
if ($attributeType == 'DateTime') {
return DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent();
}
}
示例3: makeYearModifierString
public static function makeYearModifierString($tableName, $columnName, $adjustForTimeZone = false)
{
assert('is_string($tableName)');
assert('is_string($columnName)');
assert('is_bool($adjustForTimeZone)');
$quote = DatabaseCompatibilityUtil::getQuote();
$queryString = "{$quote}{$tableName}{$quote}.{$quote}{$columnName}{$quote}";
if ($adjustForTimeZone) {
$queryString .= DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent();
}
return "year({$queryString})";
}
示例4: testMakeTimeZoneAdjustmentContent
public function testMakeTimeZoneAdjustmentContent()
{
Yii::app()->user->userModel = User::getByUsername('super');
$this->assertNull(DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent());
$tempTimeZone = Yii::app()->user->userModel->timeZone;
Yii::app()->user->userModel->timeZone = 'America/Chicago';
//Deal with daylight savings time.
$timeZoneObject = new DateTimeZone(Yii::app()->user->userModel->timeZone);
$offsetInSeconds = $timeZoneObject->getOffset(new DateTime());
$this->assertTrue($offsetInSeconds == -18000 || $offsetInSeconds == -21600);
$compareContent = ' - INTERVAL ' . abs($offsetInSeconds) . ' SECOND';
$this->assertEquals($compareContent, DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent());
Yii::app()->user->userModel->timeZone = 'Asia/Tokyo';
$compareContent = ' + INTERVAL 32400 SECOND';
$this->assertEquals($compareContent, DatabaseCompatibilityUtil::makeTimeZoneAdjustmentContent());
Yii::app()->user->userModel->timeZone = $tempTimeZone;
}