protected function format()
    {


        if (($this->getParameter('value') == null || $this->getParameter('value') == "0"))
            return '';
        elseif (($this->getParameter('value') != null) && $this->getParameter('value') instanceof Meta) {
            $dateTime = $this->getParameter('value');
            $dateTime = $dateTime->MetaValue;
        } elseif (($this->getParameter('value') != null) && $this->getParameter('value') instanceof Date)
            $dateTime = $this->getParameter('value');
        elseif (($this->getParameter('value') == null) || $this->getParameter('value') == 'now')
            $dateTime = $this->DateFactory->newLocalDate('@'.time());
        else {

            try {

                $dateTime = $this->DateFactory->newLocalDate($this->getParameter('value'));

            }catch(DateException $e)
            {
                return '';
            }

        }


        if($this->getParameter('storage'))
            $datetime = $this->DateFactory->toStorageDate($dateTime);
        else
            $datetime = $this->DateFactory->toLocalDate($dateTime);

        if ($this->getParameter('nonbreaking') == 'true')
            return str_replace(' ', '&nbsp;', $dateTime->format($this->getParameter('format')));

        return $dateTime->format($this->getParameter('format'));

    }
protected function format()
    {


        if (($this->getParameter('value') == null || $this->getParameter('value') == "0"))
            return '';
        elseif (($this->getParameter('value') != null) && $this->getParameter('value') instanceof Meta) {
            $dateTime = $this->getParameter('value');
            $dateTime = $dateTime->MetaValue;
        } elseif (($this->getParameter('value') != null) && $this->getParameter('value') instanceof Date)
            $dateTime = $this->getParameter('value');
        elseif (($this->getParameter('value') == null) || $this->getParameter('value') == 'now')
            $dateTime = $this->DateFactory->newLocalDate('@'.time());
        else {

            try {

                $dateTime = $this->DateFactory->newLocalDate($this->getParameter('value'));

            }catch(DateException $e)
            {
                return '';
            }

        }


        if($this->getParameter('storage'))
            $datetime = $this->DateFactory->toStorageDate($dateTime);
        else
            $datetime = $this->DateFactory->toLocalDate($dateTime);

        if ($this->getParameter('nonbreaking') == 'true')
            return str_replace(' ', '&nbsp;', $dateTime->format($this->getParameter('format')));

        return $dateTime->format($this->getParameter('format'));

    }
protected function format ( ) { if ( ( $ this -> getParameter ( 'value' ) == null || $ this -> getParameter ( 'value' ) == "0" ) ) return '' ; elseif ( ( $ this -> getParameter ( 'value' ) != null ) && $ this -> getParameter ( 'value' ) instanceof Meta ) { $ dateTime = $ this -> getParameter ( 'value' ) ; $ dateTime = $ dateTime -> MetaValue ; } elseif ( ( $ this -> getParameter ( 'value' ) != null ) && $ this -> getParameter ( 'value' ) instanceof Date ) $ dateTime = $ this -> getParameter ( 'value' ) ; elseif ( ( $ this -> getParameter ( 'value' ) == null ) || $ this -> getParameter ( 'value' ) == 'now' ) $ dateTime = $ this -> DateFactory -> newLocalDate ( '@' . time ( ) ) ; else { try { $ dateTime = $ this -> DateFactory -> newLocalDate ( $ this -> getParameter ( 'value' ) ) ; } catch ( DateException $ e ) { return '' ; } } if ( $ this -> getParameter ( 'storage' ) ) $ datetime = $ this -> DateFactory -> toStorageDate ( $ dateTime ) ; else $ datetime = $ this -> DateFactory -> toLocalDate ( $ dateTime ) ; if ( $ this -> getParameter ( 'nonbreaking' ) == 'true' ) return str_replace ( ' ' , '&nbsp;' , $ dateTime -> format ( $ this -> getParameter ( 'format' ) ) ) ; return $ dateTime -> format ( $ this -> getParameter ( 'format' ) ) ; }
Returns the date in a specified format

Expected Params:
value       integer (optional) If specified, we'll use this as the date value. Can also be 'now' to use the current time
nonbreaking string  (optional) If 'true', then the resultant string will contain &nbsp;'s instead of spaces
format      string  The format for the date to use

@return string
Returns the date in a specified format