本文整理汇总了PHP中DateTimeUtil::resolveDateAsDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::resolveDateAsDateTime方法的具体用法?PHP DateTimeUtil::resolveDateAsDateTime怎么用?PHP DateTimeUtil::resolveDateAsDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeUtil
的用法示例。
在下文中一共展示了DateTimeUtil::resolveDateAsDateTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolveValueAndSetToModel
/**
* Utilized to create or update model attribute values after a workflow's triggers are fired as true.
* @param WorkflowActionProcessingModelAdapter $adapter
* @param $attribute
* @throws NotSupportedException
*/
public function resolveValueAndSetToModel(WorkflowActionProcessingModelAdapter $adapter, $attribute)
{
assert('is_string($attribute)');
if ($this->type == static::TYPE_STATIC) {
$adapter->getModel()->{$attribute} = $this->value;
} elseif ($this->type == self::TYPE_DYNAMIC_FROM_TRIGGERED_DATE) {
$newTimeStamp = $this->resolveNewTimeStampForDuration(time());
$adapter->getModel()->{$attribute} = DateTimeUtil::convertTimestampToDbFormatDate($newTimeStamp);
} elseif ($this->type == self::TYPE_DYNAMIC_FROM_EXISTING_DATE) {
if (!DateTimeUtil::isDateStringNull($adapter->getModel()->{$attribute})) {
$existingTimeStamp = DateTimeUtil::convertDbFormatDateTimeToTimestamp(DateTimeUtil::resolveDateAsDateTime($adapter->getModel()->{$attribute}));
$newTimeStamp = $this->resolveNewTimeStampForDuration($existingTimeStamp);
$newDate = DateTimeUtil::convertTimestampToDbFormatDate($newTimeStamp);
$adapter->getModel()->{$attribute} = $newDate;
}
} else {
throw new NotSupportedException();
}
}
示例2: resolveTimeStampForDateAttributeForProcessDateTime
/**
* @param TimeTriggerForWorkflowForm $trigger
* @param RedBeanModel $model
* @return int
* @throws ValueForProcessDateTimeIsNullException
*/
protected static function resolveTimeStampForDateAttributeForProcessDateTime(TimeTriggerForWorkflowForm $trigger, RedBeanModel $model)
{
$date = static::resolveModelValueByTimeTrigger($trigger, $model);
if (DateTimeUtil::isDateStringNull($date)) {
throw new ValueForProcessDateTimeIsNullException();
} else {
return $trigger->resolveNewTimeStampForDuration(DateTimeUtil::convertDbFormatDateTimeToTimestamp(DateTimeUtil::resolveDateAsDateTime($date)));
}
}
示例3: sanitizeAndResolveThirdValue
protected function sanitizeAndResolveThirdValue()
{
if ($this->trigger->valueEvaluationType == 'Date') {
$todayDate = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), time());
$todayDateTime = DateTimeUtil::resolveDateAsDateTime($todayDate);
return $this->trigger->resolveNewTimeStampForThirdValueDuration(strtotime($todayDateTime));
} elseif ($this->trigger->valueEvaluationType == 'DateTime') {
$timeZone = date_default_timezone_get();
date_default_timezone_set('GMT');
$timeStamp = $this->trigger->resolveNewTimeStampForThirdValueDuration(time());
date_default_timezone_set($timeZone);
return $timeStamp;
} else {
throw new NotSupportedException();
}
}