public static function formatted_timeframe($startStr, $endStr)
    {
        $str = null;

        if ($startStr == $endStr) {
            return null;
        }

        $startTime = strtotime($startStr->value);
        $endTime = strtotime($endStr->value);

        if ($startTime == $endTime) {
            return null;
        }

        if ($endStr) {
            //time frame is only applicable if both start and end time is on the same day
            if (date('Y-m-d', $startTime) == date('Y-m-d', $endTime)) {
                $str = date('g:ia', $startTime) . ' - ' . date('g:ia', $endTime);
            }
        } else {
            $str = date('g:ia', $startTime);
        }

        return $str;
    }
public static function formatted_timeframe($startStr, $endStr)
    {
        $str = null;

        if ($startStr == $endStr) {
            return null;
        }

        $startTime = strtotime($startStr->value);
        $endTime = strtotime($endStr->value);

        if ($startTime == $endTime) {
            return null;
        }

        if ($endStr) {
            //time frame is only applicable if both start and end time is on the same day
            if (date('Y-m-d', $startTime) == date('Y-m-d', $endTime)) {
                $str = date('g:ia', $startTime) . ' - ' . date('g:ia', $endTime);
            }
        } else {
            $str = date('g:ia', $startTime);
        }

        return $str;
    }
public static function formatted_timeframe ( $ startStr , $ endStr ) { $ str = null ; if ( $ startStr == $ endStr ) { return null ; } $ startTime = strtotime ( $ startStr -> value ) ; $ endTime = strtotime ( $ endStr -> value ) ; if ( $ startTime == $ endTime ) { return null ; } if ( $ endStr ) { //time frame is only applicable if both start and end time is on the same day if ( date ( 'Y-m-d' , $ startTime ) == date ( 'Y-m-d' , $ endTime ) ) { $ str = date ( 'g:ia' , $ startTime ) . ' - ' . date ( 'g:ia' , $ endTime ) ; } } else { $ str = date ( 'g:ia' , $ startTime ) ; } return $ str ; }
Formatted time frame
Returns either a string or null
Time frame is only applicable if both start and end time is on the same day
@param string $startStr
@param string $endStr
@return string|null
Formatted time frame Returns either a string or null Time frame is only applicable if both start and end time is on the same day