3

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.

‌‌R‌‌‌.
  • 2,818
  • 26
  • 37

1 Answers1

3

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'));
brady.vitrano
  • 2,256
  • 2
  • 16
  • 26
  • 1
    16th of Tir (4th month in Jalali calendar) is 6th of July **NOT** 16th of April (4th month in Gregorian ). You cannot enter a Jalali date for first argument. – undone Jun 29 '16 at 00:10
  • `آوریل 16, 1390` means 16th of April of 1390. – undone Jun 29 '16 at 00:11