我遇到这种情况:
$date = new Zend_Date();
$date->toString(Zend_Date::DATE_MEDIUM);
在Zend Framework文档中,我可以阅读日期和时间格式(格式因地区而异)
更新:
/**
* Convert a date from yyyy/mm/dd formatted by the locale setting
*
* @param date $dbindata
* @param $format Zend_date format
* @return date formatted by the locale setting
*/
static public function formatDateOut($dbindata, $format=Zend_Date::DATE_MEDIUM) {
if (empty ( $dbindata ))
return false;
$locale = Zend_Registry::get('Zend_Locale');
$date = new Zend_Date($dbindata, "yyyy-MM-dd HH:mm:ss", $locale);
return $date->get($format);
}
为什么?
答案 0 :(得分:0)
我认为您必须使用Zend_Date对象的“get()”方法来获取所需的格式。
$date = new Zend_Date();
echo $date->get(Zend_Date::DATE_MEDIUM);