/** * 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(); } }