public static function getDateRangeText($startDate, $endDate, $toSeparator = 'to')
    {
        if ($startDate == $endDate) {
            return self::format($startDate, DateFormat::FORMAT_SHORT);
        } elseif (self::format($startDate, DateFormat::FORMAT_YEAR)
            == self::format($endDate, DateFormat::FORMAT_YEAR)
        ) {
            $start_date = (
                self::format($startDate, DateFormat::FORMAT_MONTH)
                == self::format($endDate, DateFormat::FORMAT_MONTH))
                ? self::format($startDate, DateFormat::FORMAT_DAY) :
                self::format($startDate, DateFormat::FORMAT_SHORT_NO_YEAR);
        } else {
            $start_date = self::format($startDate, DateFormat::FORMAT_SHORT);
        }
        return $start_date . ' ' . $toSeparator . ' ' . self::format($endDate, DateFormat::FORMAT_SHORT);
    }
public static function getDateRangeText($startDate, $endDate, $toSeparator = 'to')
    {
        if ($startDate == $endDate) {
            return self::format($startDate, DateFormat::FORMAT_SHORT);
        } elseif (self::format($startDate, DateFormat::FORMAT_YEAR)
            == self::format($endDate, DateFormat::FORMAT_YEAR)
        ) {
            $start_date = (
                self::format($startDate, DateFormat::FORMAT_MONTH)
                == self::format($endDate, DateFormat::FORMAT_MONTH))
                ? self::format($startDate, DateFormat::FORMAT_DAY) :
                self::format($startDate, DateFormat::FORMAT_SHORT_NO_YEAR);
        } else {
            $start_date = self::format($startDate, DateFormat::FORMAT_SHORT);
        }
        return $start_date . ' ' . $toSeparator . ' ' . self::format($endDate, DateFormat::FORMAT_SHORT);
    }
public static function getDateRangeText ( $ startDate , $ endDate , $ toSeparator = 'to' ) { if ( $ startDate == $ endDate ) { return self :: format ( $ startDate , DateFormat :: FORMAT_SHORT ) ; } elseif ( self :: format ( $ startDate , DateFormat :: FORMAT_YEAR ) == self :: format ( $ endDate , DateFormat :: FORMAT_YEAR ) ) { $ start_date = ( self :: format ( $ startDate , DateFormat :: FORMAT_MONTH ) == self :: format ( $ endDate , DateFormat :: FORMAT_MONTH ) ) ? self :: format ( $ startDate , DateFormat :: FORMAT_DAY ) : self :: format ( $ startDate , DateFormat :: FORMAT_SHORT_NO_YEAR ) ; } else { $ start_date = self :: format ( $ startDate , DateFormat :: FORMAT_SHORT ) ; } return $ start_date . ' ' . $ toSeparator . ' ' . self :: format ( $ endDate , DateFormat :: FORMAT_SHORT ) ; }
Returns date range text
@author Adeyemi Olaoye <yemi@cottacush.com>
@author Olawale Lawal <wale@cottacush.com>
@param $startDate
@param $endDate
@param string $toSeparator
@return string
Returns date range text