public static function getUserDateTime( BaseDateTime $date, $timezone = '' )
    {
        $newDate = new BaseDateTime( );
        $newDate->setTimestamp( $date->getTimestamp() );
        
        if ( is_string( $timezone ) && !empty( $timezone ) )
        {
            $timezone = new DateTimeZone( $timezone );
        }
        if ( empty( $timezone ) )
        {
            $timezone = new DateTimeZone( ini_get( 'date.timezone' ) );
        }
        
        $newDate->setTimezone( $timezone );
        
        return $newDate;
    }
public static function getUserDateTime( BaseDateTime $date, $timezone = '' )
    {
        $newDate = new BaseDateTime( );
        $newDate->setTimestamp( $date->getTimestamp() );
        
        if ( is_string( $timezone ) && !empty( $timezone ) )
        {
            $timezone = new DateTimeZone( $timezone );
        }
        if ( empty( $timezone ) )
        {
            $timezone = new DateTimeZone( ini_get( 'date.timezone' ) );
        }
        
        $newDate->setTimezone( $timezone );
        
        return $newDate;
    }
public static function getUserDateTime ( BaseDateTime $ date , $ timezone = '' ) { $ newDate = new BaseDateTime ( ) ; $ newDate -> setTimestamp ( $ date -> getTimestamp ( ) ) ; if ( is_string ( $ timezone ) && ! empty ( $ timezone ) ) { $ timezone = new DateTimeZone ( $ timezone ) ; } if ( empty ( $ timezone ) ) { $ timezone = new DateTimeZone ( ini_get ( 'date.timezone' ) ) ; } $ newDate -> setTimezone ( $ timezone ) ; return $ newDate ; }
Converts the UTC date time object to user time.

@param BaseDateTime $date     the date time to convert
@param string    $timezone the time zone

@return BaseDateTime the user timezone date time object
Converts the UTC date time object to user time .