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


PHP DateTimeUtil::getLastDayOfLastMonthDate方法代码示例

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


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

示例1: resolveAttributesAndRelations

 /**
  * The value['type'] determines how the attributeAndRelations is structured.
  * @param string $attributeName
  * @param array $attributeAndRelations
  * @param mixed $value
  */
 public static function resolveAttributesAndRelations($attributeName, &$attributeAndRelations, $value)
 {
     assert('is_string($attributeName)');
     assert('$attributeAndRelations == "resolveEntireMappingByRules"');
     assert('empty($value) || $value == null || is_array($value)');
     $delimiter = FormModelUtil::DELIMITER;
     $parts = explode($delimiter, $attributeName);
     if (count($parts) != 2) {
         throw new NotSupportedException();
     }
     list($realAttributeName, $type) = $parts;
     if (isset($value['type']) && $value['type'] != null) {
         if ($value['type'] == self::TYPE_YESTERDAY || $value['type'] == self::TYPE_TODAY || $value['type'] == self::TYPE_TOMORROW || $value['type'] == self::TYPE_ON) {
             $dateValue = static::resolveValueDataIntoUsableValue($value);
             $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($dateValue);
             $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($dateValue);
             $attributeAndRelations = array(array($realAttributeName, null, 'greaterThanOrEqualTo', $greaterThanValue, true), array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue, true));
         } elseif ($value['type'] == self::TYPE_AFTER) {
             $dateValue = static::resolveValueDataIntoUsableValue($value);
             $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($dateValue);
             $attributeAndRelations = array(array($realAttributeName, null, 'greaterThanOrEqualTo', $greaterThanValue));
         } elseif ($value['type'] == self::TYPE_BEFORE) {
             $dateValue = static::resolveValueDataIntoUsableValue($value);
             $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($dateValue);
             $attributeAndRelations = array(array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue));
         } elseif ($value['type'] == self::TYPE_BETWEEN) {
             $firstDateValue = static::resolveValueDataForBetweenIntoUsableFirstDateValue($value);
             $secondDateValue = static::resolveValueDataForBetweenIntoUsableSecondDateValue($value);
             if ($firstDateValue == null) {
                 $greaterThanValue = null;
             } else {
                 $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($firstDateValue);
             }
             if ($secondDateValue == null) {
                 $lessThanValue = null;
             } else {
                 $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($secondDateValue);
             }
             $attributeAndRelations = array(array($realAttributeName, null, 'greaterThanOrEqualTo', $greaterThanValue, true), array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue, true));
         } elseif ($value['type'] == self::TYPE_NEXT_7_DAYS) {
             $today = static::calculateNewDateByDaysFromNow(0);
             $todayPlusSevenDays = static::calculateNewDateByDaysFromNow(7);
             $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($today);
             $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($todayPlusSevenDays);
             $attributeAndRelations = array(array($realAttributeName, null, 'greaterThanOrEqualTo', $greaterThanValue, true), array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue, true));
         } elseif ($value['type'] == self::TYPE_LAST_7_DAYS) {
             $today = static::calculateNewDateByDaysFromNow(0);
             $todayMinusSevenDays = static::calculateNewDateByDaysFromNow(-7);
             $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($todayMinusSevenDays);
             $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($today);
             $attributeAndRelations = array(array($realAttributeName, null, 'greaterThanOrEqualTo', $greaterThanValue, true), array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue, true));
         } elseif ($value['type'] == self::TYPE_LAST_30_DAYS) {
             $today = static::calculateNewDateByDaysFromNow(0);
             $todayMinusThirtyDays = static::calculateNewDateByDaysFromNow(-30);
             $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($todayMinusThirtyDays);
             $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($today);
             $attributeAndRelations = array(array($realAttributeName, null, 'greaterThanOrEqualTo', $greaterThanValue, true), array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue, true));
         } elseif ($value['type'] == self::TYPE_THIS_MONTH) {
             $firstDateValue = DateTimeUtil::getFirstDayOfAMonthDate();
             $secondDateValue = DateTimeUtil::getLastDayOfAMonthDate();
             $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($firstDateValue);
             $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($secondDateValue);
             $attributeAndRelations = array(array($realAttributeName, null, 'greaterThanOrEqualTo', $greaterThanValue, true), array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue, true));
         } elseif ($value['type'] == self::TYPE_LAST_MONTH) {
             $firstDateValue = DateTimeUtil::getFirstDayOfLastMonthDate();
             $secondDateValue = DateTimeUtil::getLastDayOfLastMonthDate();
             $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($firstDateValue);
             $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($secondDateValue);
             $attributeAndRelations = array(array($realAttributeName, null, 'greaterThanOrEqualTo', $greaterThanValue, true), array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue, true));
         } elseif ($value['type'] == self::TYPE_NEXT_MONTH) {
             $firstDateValue = DateTimeUtil::getFirstDayOfNextMonthDate();
             $secondDateValue = DateTimeUtil::getLastDayOfNextMonthDate();
             $greaterThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($firstDateValue);
             $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($secondDateValue);
             $attributeAndRelations = array(array($realAttributeName, null, 'greaterThanOrEqualTo', $greaterThanValue, true), array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue, true));
         } elseif ($value['type'] == self::TYPE_BEFORE_TODAY) {
             $today = static::calculateNewDateByDaysFromNow(0);
             $lessThanValue = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($today);
             $attributeAndRelations = array(array($realAttributeName, null, 'lessThanOrEqualTo', $lessThanValue));
         } else {
             throw new NotSupportedException();
         }
     } else {
         $attributeAndRelations = array(array($realAttributeName, null, null, 'resolveValueByRules'));
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:92,代码来源:MixedDateTimeTypesSearchFormAttributeMappingRules.php


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