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'));

    }