开发者

Zend Jalali Date

Does Zend support jalali date and calendar?

And How can i get that ?

I tried this:

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

will not work as I want 开发者_开发问答for me.


Zend_Date supports fa_IR dates, but I don't believe it will do calendar conversions from Gregorian to Jalali. You will have to set date manually. However, here is how you use Zend_Locale with Zend_Date for 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 قبل از ظهر

Edit

I forgot to mention. I have Zend_Date format_type set to php as default format

Zend_Date::setOptions(array('format_type' => 'php'));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜