protected function getFormattedDate()
{
$value = $this->getValue();
$defaultText = $this->getDefaultText();
if (empty($value) && !empty($defaultText)) {
return $this->getDefaultText();
}
$app = $this->getApplication()->getGlobalization();
//initialized the default class wide formatter
if (self::$formatter === null) {
self::$formatter = new DateFormat($app->getCulture());
}
$culture = $this->getCulture();
//return the specific cultural formatted date time
if (strlen($culture) && $app->getCulture() !== $culture) {
$formatter = new DateFormat($culture);
return $formatter->format($value, $this->getPattern(), $this->getCharset());
}
//return the application wide culture formatted date time.
$result = self::$formatter->format($value, $this->getPattern(), $this->getCharset());
return $result;
}