Zend Jalali 日期
·
问题:Zend Jalali 日期
Zend 是否支持 jalali 日期和日历?
我怎么能得到那个?
我试过这个:
$locale = new Zend_Locale('fa_IR');
$date = new Zend_Date();
$new_date= Zend_Locale_Format::getDate($date,
array(
'date_format' =>Zend_Locale_Format::getDateFormat('fa_IR'),
'locale' => $locale,
'fix_date' =>true
)
);
不会像我想要的那样工作。
解答
Zend_Date支持fa_IR日期,但我不相信它会进行从公历到 Jalali 的日历转换。您必须手动设置日期。然而,这里是你如何使用Zend_Locale和Zend_Date为fa_IR
// Manual conversion from Gregorian date 7/7/2011 to Jalali date 1390/4/16
$date = new Zend_Date('1390/4/16');
$date->setLocale('fa_IR');
echo $date->toString('F j, Y, g:i a');
// prints آوریل 16, 1390, 12:00 قبل از ظهر
编辑
我忘了提。我将Zend_Date``format_type设置为php作为默认格式
Zend_Date::setOptions(array('format_type' => 'php'));
更多推荐
所有评论(0)