当前位置: 首页>>代码示例>>PHP>>正文


PHP DatabaseCompatibilityUtil::getDateFormat方法代码示例

本文整理汇总了PHP中DatabaseCompatibilityUtil::getDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseCompatibilityUtil::getDateFormat方法的具体用法?PHP DatabaseCompatibilityUtil::getDateFormat怎么用?PHP DatabaseCompatibilityUtil::getDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DatabaseCompatibilityUtil的用法示例。


在下文中一共展示了DatabaseCompatibilityUtil::getDateFormat方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testDefaultCalculatedDates

 public function testDefaultCalculatedDates()
 {
     $now = time();
     $thing = new ThingWithCalculatedDates();
     $thingNowValue = $thing->now;
     $this->assertEquals(DateTimeUtil::convertTimestampToDbFormatDateTime($now), $thing->now);
     $this->assertTrue($thing->save());
     $this->assertEquals($thingNowValue, $thing->now);
     $stamp = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $now);
     $this->assertEquals($stamp, $thing->today);
     $stamp = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $now + 24 * 60 * 60);
     $this->assertEquals($stamp, $thing->tomorrow);
     $stamp = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $now - 24 * 60 * 60);
     $this->assertEquals($stamp, $thing->yesterday);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:15,代码来源:RedBeanModelDefaultCalculatedDateValidatorTest.php

示例2: populateModel

 public function populateModel(&$model)
 {
     assert('$model instanceof Opportunity');
     $opportunityRandomData = ZurmoRandomDataUtil::getRandomDataByModuleAndModelClassNames('OpportunitiesModule', 'Opportunity');
     parent::populateModel($model);
     $name = RandomDataUtil::getRandomValueFromArray($opportunityRandomData['names']);
     $model->name = $name;
     $stage = RandomDataUtil::getRandomValueFromArray(static::getCustomFieldDataByName('SalesStages'));
     $source = RandomDataUtil::getRandomValueFromArray(static::getCustomFieldDataByName('LeadSources'));
     $model->stage->value = $stage;
     $model->source->value = $source;
     $futureTimeStamp = time() + mt_rand(1, 200) * 60 * 60 * 24;
     $closeDate = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $futureTimeStamp);
     $model->closeDate = $closeDate;
     $model->amount->value = mt_rand(5, 350) * 1000;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:16,代码来源:OpportunitiesDemoDataMaker.php

示例3: testValidAndInvalidDateDateTimeValidation

 public function testValidAndInvalidDateDateTimeValidation()
 {
     $language = Yii::app()->getLanguage();
     $this->assertEquals($language, 'en');
     $this->assertEquals(false, CDateTimeParser::parse('04:04:1980', DatabaseCompatibilityUtil::getDateFormat()));
     $this->assertEquals(null, DateTimeUtil::resolveValueForDateLocaleFormattedDisplay('04:04:1980'));
     $model = new DateDateTime();
     $model->aDate = '04:04:1980';
     $model->aDateTime = 'notATimeStamp';
     $saved = $model->save();
     $this->assertFalse($saved);
     $compareData = array('aDate' => array('A Date must be date.'), 'aDateTime' => array('A Date Time must be datetime.'));
     $this->assertEquals($compareData, $model->getErrors());
     //Now test setting an integer for dateTime which is wrong
     $model = new DateDateTime();
     $model->aDate = '1981-07-05';
     $model->aDateTime = 1241341412421;
     $saved = $model->save();
     $this->assertFalse($saved);
     $compareData = array('aDateTime' => array('A Date Time must be datetime.'));
     $this->assertEquals($compareData, $model->getErrors());
     //Now test a successful validation.
     $this->assertEquals('M/d/yy', DateTimeUtil::getLocaleDateFormat());
     $model = new DateDateTime();
     $model->aDate = '1981-07-05';
     $model->aDateTime = '1981-07-05 04:04:04';
     $saved = $model->save();
     $this->assertEquals(array(), $model->getErrors());
     $this->assertTrue($saved);
     $this->assertNull($model->aDateTime2);
     //now set DateTime2 and test if you save and then clear it that it is behaving properly.
     $model->aDateTime2 = '1981-07-05 04:04:04';
     $saved = $model->save();
     $this->assertTrue($saved);
     $this->assertEquals('1981-07-05 04:04:04', $model->aDateTime2);
     $model->aDateTime2 = null;
     $saved = $model->save();
     $this->assertTrue($saved);
     $id = $model->id;
     $model->forget();
     $model = DateDateTime::getById($id);
     $this->assertNull($model->aDateTime2);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:43,代码来源:RedBeanModelTypeValidatorTest.php

示例4: testCalculateNew

 public function testCalculateNew()
 {
     //Test Today.
     $todayDateStamp = DateTimeCalculatorUtil::calculateNew(DateTimeCalculatorUtil::TODAY, new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser())));
     $todayDateTime = new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser()));
     $today = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $todayDateTime->getTimeStamp());
     $this->assertEquals($today, $todayDateStamp);
     //Test Tomorrow.
     $tomorrowDateStamp = DateTimeCalculatorUtil::calculateNew(DateTimeCalculatorUtil::TOMORROW, new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser())));
     $tomorrowDateTime = new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser()));
     $tomorrow = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $tomorrowDateTime->getTimeStamp() + 60 * 60 * 24);
     $this->assertEquals($tomorrow, $tomorrowDateStamp);
     //Test Yesterday.
     $yesterdayDateStamp = DateTimeCalculatorUtil::calculateNew(DateTimeCalculatorUtil::YESTERDAY, new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser())));
     $yesterdayDateTime = new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser()));
     $yesterday = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $yesterdayDateTime->getTimeStamp() - 60 * 60 * 24);
     $this->assertEquals($yesterday, $yesterdayDateStamp);
     //Test Now.
     $nowDateTimeStamp = DateTimeCalculatorUtil::calculateNew(DateTimeCalculatorUtil::NOW, new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser())));
     $nowDateTime = new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser()));
     $this->assertWithinTolerance($nowDateTime->getTimeStamp(), DateTimeUtil::convertDbFormatDateTimeToTimestamp($nowDateTimeStamp), 1);
     //Now test all calculations using a different time zone.
     $this->assertNotEquals('Europe/Malta', Yii::app()->timeZoneHelper->getForCurrentUser());
     //Test Today.
     $todayDateStamp = DateTimeCalculatorUtil::calculateNew(DateTimeCalculatorUtil::TODAY, new DateTime(null, new DateTimeZone('Europe/Malta')));
     $todayDateTime = new DateTime(null, new DateTimeZone('Europe/Malta'));
     $today = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $todayDateTime->getTimeStamp());
     $this->assertEquals($today, $todayDateStamp);
     //Test Tomorrow.
     $tomorrowDateStamp = DateTimeCalculatorUtil::calculateNew(DateTimeCalculatorUtil::TOMORROW, new DateTime(null, new DateTimeZone('Europe/Malta')));
     $tomorrowDateTime = new DateTime(null, new DateTimeZone('Europe/Malta'));
     $tomorrow = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $tomorrowDateTime->getTimeStamp() + 60 * 60 * 24);
     $this->assertEquals($tomorrow, $tomorrowDateStamp);
     //Test Yesterday.
     $yesterdayDateStamp = DateTimeCalculatorUtil::calculateNew(DateTimeCalculatorUtil::YESTERDAY, new DateTime(null, new DateTimeZone('Europe/Malta')));
     $yesterdayDateTime = new DateTime(null, new DateTimeZone('Europe/Malta'));
     $yesterday = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $yesterdayDateTime->getTimeStamp() - 60 * 60 * 24);
     $this->assertEquals($yesterday, $yesterdayDateStamp);
     //Test Now.
     $nowDateTimeStamp = DateTimeCalculatorUtil::calculateNew(DateTimeCalculatorUtil::NOW, new DateTime(null, new DateTimeZone('Europe/Malta')));
     $nowDateTime = new DateTime(null, new DateTimeZone('Europe/Malta'));
     $this->assertWithinTolerance($nowDateTime->getTimeStamp(), DateTimeUtil::convertDbFormatDateTimeToTimestamp($nowDateTimeStamp), 1);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:43,代码来源:DateTimeCalculatorUtilTest.php

示例5: setAndGetDateAttribute

 protected function setAndGetDateAttribute($attributeName, $withDefaultData)
 {
     $this->assertTrue(isset($attributeName) && $attributeName != '');
     $this->assertTrue(isset($withDefaultData) && is_bool($withDefaultData));
     $attributeForm = new DateAttributeForm();
     $attributeForm->attributeName = $attributeName;
     $attributeForm->attributeLabels = array('de' => 'Test Date 2 de', 'en' => 'Test Date 2 en', 'es' => 'Test Date 2 es', 'fr' => 'Test Date 2 fr', 'it' => 'Test Date 2 it');
     $attributeForm->isAudited = true;
     $attributeForm->isRequired = true;
     if ($withDefaultData) {
         $attributeForm->defaultValueCalculationType = DateTimeCalculatorUtil::YESTERDAY;
     }
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new Account());
     try {
         $adapter->setAttributeMetadataFromForm($attributeForm);
     } catch (FailedDatabaseSchemaChangeException $e) {
         echo $e->getMessage();
         $this->fail();
     }
     $attributeForm = AttributesFormFactory::createAttributeFormByAttributeName(new Account(), $attributeName . 'Cstm');
     $this->assertEquals('Date', $attributeForm->getAttributeTypeName());
     $this->assertEquals($attributeName . 'Cstm', $attributeForm->attributeName);
     $compareAttributeLabels = array('de' => 'Test Date 2 de', 'en' => 'Test Date 2 en', 'es' => 'Test Date 2 es', 'fr' => 'Test Date 2 fr', 'it' => 'Test Date 2 it');
     $this->assertEquals($compareAttributeLabels, $attributeForm->attributeLabels);
     $this->assertEquals(true, $attributeForm->isAudited);
     $this->assertEquals(true, $attributeForm->isRequired);
     if ($withDefaultData) {
         $this->assertEquals(DateTimeCalculatorUtil::YESTERDAY, $attributeForm->defaultValueCalculationType);
         //Confirm default calculation loads correct default value for Account.
         $account = new Account();
         $yesterdayDateTime = new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser()));
         $yesterday = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $yesterdayDateTime->getTimeStamp() - 60 * 60 * 24);
         $this->assertEquals($yesterday, $account->{$attributeName . 'Cstm'});
     } else {
         $account = new Account();
         $this->assertEquals(null, $attributeForm->defaultValueCalculationType);
         $this->assertEquals(null, $account->{$attributeName . 'Cstm'});
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:40,代码来源:AttributesTest.php

示例6: testGetMetadataForDynamicDateTimeAttributeThatIsOnManyRelatedModel

 public function testGetMetadataForDynamicDateTimeAttributeThatIsOnManyRelatedModel()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $searchForm = new ASearchFormTestModel(new MixedRelationsModel());
     //Make sure the timeZone is different than UTC for testing.
     Yii::app()->user->userModel->timeZone = 'America/Chicago';
     //TEST when no value present
     $metadata = SearchFormAttributesToSearchDataProviderMetadataUtil::getMetadata($searchForm, 'dateDateTimeADate__Date', null);
     $compareData = array(array('manyMany' => array('value' => array('aDate' => null))));
     $this->assertEquals($compareData, $metadata);
     //Test Date = Today
     $value = array();
     $value['type'] = MixedDateTypesSearchFormAttributeMappingRules::TYPE_TODAY;
     $metadata = SearchFormAttributesToSearchDataProviderMetadataUtil::getMetadata($searchForm, 'dateDateTimeADateTime__DateTime', $value);
     $todayDateTime = new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser()));
     $today = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $todayDateTime->getTimeStamp());
     $compareData = array(array('manyMany' => array('value' => array('aDateTime' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($today)), 'operatorType' => 'greaterThanOrEqualTo', 'appendStructureAsAnd' => true)), array('manyMany' => array('value' => array('aDateTime' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($today)), 'operatorType' => 'lessThanOrEqualTo', 'appendStructureAsAnd' => true)));
     $this->assertEquals($compareData, $metadata);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:20,代码来源:SearchFormAttributesToSearchDataProviderMetadataUtilTest.php

示例7: testGetDateFormat

 public function testGetDateFormat()
 {
     $this->assertEquals('yyyy-MM-dd', DatabaseCompatibilityUtil::getDateFormat());
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:4,代码来源:DatabaseCompatibilityUtilTest.php

示例8: testSearchFormDynamicAttributes

 public function testSearchFormDynamicAttributes()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $searchAttributes = array('aaaMember' => 'Vomitorio Corp', 'bbb' => array('relatedData' => true, 'ccc' => array('relatedData' => true, 'date__Date' => array('type' => MixedDateTypesSearchFormAttributeMappingRules::TYPE_AFTER, 'firstDate' => '1991-03-04'), 'dateTime__DateTime' => array('type' => MixedDateTypesSearchFormAttributeMappingRules::TYPE_TODAY), 'dateTime2__DateTime' => array('value' => null), 'eee' => array('relatedData' => true, 'eeeMember' => 'eeeMemberValue'), 'iii' => array('relatedData' => true, 'date__Date' => array('type' => MixedDateTypesSearchFormAttributeMappingRules::TYPE_AFTER, 'firstDate' => '1991-03-04'), 'dateTime__DateTime' => array('type' => MixedDateTypesSearchFormAttributeMappingRules::TYPE_TODAY), 'dateTime2__DateTime' => array('value' => null)))));
     $metadataAdapter = new SearchDataProviderMetadataAdapter(new AAA(false), 1, $searchAttributes);
     $todayDateTime = new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser()));
     $today = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $todayDateTime->getTimeStamp());
     $todayPlus7Days = MixedDateTypesSearchFormAttributeMappingRules::calculateNewDateByDaysFromNow(7);
     $metadata = $metadataAdapter->getAdaptedMetadata();
     $compareClauses = array(1 => array('attributeName' => 'aaaMember', 'operatorType' => 'startsWith', 'value' => 'Vomitorio Corp'), 2 => array('attributeName' => 'bbb', 'relatedModelData' => array('attributeName' => 'ccc', 'relatedModelData' => array('attributeName' => 'date', 'operatorType' => 'greaterThanOrEqualTo', 'value' => '1991-03-04'))), 3 => array('attributeName' => 'bbb', 'relatedModelData' => array('attributeName' => 'ccc', 'relatedModelData' => array('attributeName' => 'dateTime', 'operatorType' => 'greaterThanOrEqualTo', 'value' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($today)))), 4 => array('attributeName' => 'bbb', 'relatedModelData' => array('attributeName' => 'ccc', 'relatedModelData' => array('attributeName' => 'dateTime', 'operatorType' => 'lessThanOrEqualTo', 'value' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($today)))), 5 => array('attributeName' => 'bbb', 'relatedModelData' => array('attributeName' => 'ccc', 'relatedModelData' => array('attributeName' => 'eee', 'relatedModelData' => array('attributeName' => 'eeeMember', 'operatorType' => 'startsWith', 'value' => 'eeeMemberValue')))), 6 => array('attributeName' => 'bbb', 'relatedModelData' => array('attributeName' => 'ccc', 'relatedModelData' => array('attributeName' => 'iii', 'relatedModelData' => array('attributeName' => 'date', 'operatorType' => 'greaterThanOrEqualTo', 'value' => '1991-03-04')))), 7 => array('attributeName' => 'bbb', 'relatedModelData' => array('attributeName' => 'ccc', 'relatedModelData' => array('attributeName' => 'iii', 'relatedModelData' => array('attributeName' => 'dateTime', 'operatorType' => 'greaterThanOrEqualTo', 'value' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($today))))), 8 => array('attributeName' => 'bbb', 'relatedModelData' => array('attributeName' => 'ccc', 'relatedModelData' => array('attributeName' => 'iii', 'relatedModelData' => array('attributeName' => 'dateTime', 'operatorType' => 'lessThanOrEqualTo', 'value' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($today))))));
     $compareStructure = '1 and (2) and (3 and 4) and 5 and (6) and (7 and 8)';
     $this->assertEquals($compareClauses, $metadata['clauses']);
     $this->assertEquals($compareStructure, $metadata['structure']);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:15,代码来源:SearchDataProviderMetadataAdapterForRecursiveSearchesTest.php

示例9: testSearchFormDynamicAttributes

 public function testSearchFormDynamicAttributes()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $searchAttributes = array('date__Date' => array('type' => MixedDateTypesSearchFormAttributeMappingRules::TYPE_AFTER, 'firstDate' => '1991-03-04'), 'dateTime__DateTime' => array('type' => MixedDateTypesSearchFormAttributeMappingRules::TYPE_TODAY), 'dateTime2__DateTime' => array('value' => null));
     $searchForm = new MixedRelationsModelSearchFormTestModel(new MixedRelationsModel());
     $metadataAdapter = new SearchDataProviderMetadataAdapter($searchForm, $super->id, $searchAttributes);
     $todayDateTime = new DateTime(null, new DateTimeZone(Yii::app()->timeZoneHelper->getForCurrentUser()));
     $today = Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $todayDateTime->getTimeStamp());
     $todayPlus7Days = MixedDateTypesSearchFormAttributeMappingRules::calculateNewDateByDaysFromNow(7);
     $metadata = $metadataAdapter->getAdaptedMetadata();
     $compareClauses = array(1 => array('attributeName' => 'date', 'operatorType' => 'greaterThanOrEqualTo', 'value' => '1991-03-04'), 2 => array('attributeName' => 'dateTime', 'operatorType' => 'greaterThanOrEqualTo', 'value' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($today)), 3 => array('attributeName' => 'dateTime', 'operatorType' => 'lessThanOrEqualTo', 'value' => DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($today)));
     $compareStructure = '(1) and (2 and 3)';
     $this->assertEquals($compareClauses, $metadata['clauses']);
     $this->assertEquals($compareStructure, $metadata['structure']);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:16,代码来源:SearchDataProviderMetadataAdapterTest.php

示例10: calculateNewByDaysFromNow

 /**
  * Given an integer representing a count of days from the present day, returns a DB formatted date stamp based
  * on that calculation.
  * @param integer $daysFromNow
  */
 public static function calculateNewByDaysFromNow($daysFromNow, DateTime $dateTime)
 {
     assert('is_int($daysFromNow)');
     $dateTime->modify($daysFromNow . ' day');
     return Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $dateTime->getTimestamp());
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:11,代码来源:DateTimeCalculatorUtil.php

示例11: getLastDayOfAMonthDate

 public static function getLastDayOfAMonthDate($stringTime = null)
 {
     assert('is_string($stringTime) || $stringTime == null');
     $dateTime = new DateTime($stringTime);
     $dateTime->modify('last day of this month');
     return Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $dateTime->getTimestamp());
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:7,代码来源:DateTimeUtil.php

示例12: 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();
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:16,代码来源:DateTriggerRules.php

示例13: getTomorrowsDate

 /**
  * Gets tomorrows date.
  * @return string
  */
 public static function getTomorrowsDate()
 {
     $dateTime = new DateTime();
     $dateTime->modify('tomorrow');
     return Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $dateTime->getTimestamp());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:10,代码来源:DateTimeUtil.php

示例14: getEndDate

 /**
  * Gets end date.
  * @param string $dateRangeType
  * @return string
  */
 public static function getEndDate($dateRangeType)
 {
     assert('is_string($dateRangeType)');
     if ($dateRangeType == SavedCalendar::DATERANGE_TYPE_MONTH) {
         $dateTime = new DateTime();
         $dateTime->modify('first day of next month');
         return Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $dateTime->getTimestamp());
     }
     if ($dateRangeType == SavedCalendar::DATERANGE_TYPE_WEEK) {
         $dateTime = new DateTime('Monday next week');
         return Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), $dateTime->getTimestamp());
     }
     if ($dateRangeType == SavedCalendar::DATERANGE_TYPE_DAY) {
         return DateTimeUtil::getTomorrowsDate();
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:21,代码来源:CalendarUtil.php


注:本文中的DatabaseCompatibilityUtil::getDateFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。