Exemple #1
0
 protected function _convertDate($date, $locale)
 {
     if ($this->getColumn()->getFilterTime()) {
         try {
             $dateObj = $this->getLocale()->date(null, null, $locale, false);
             //set default timezone for store (admin)
             $dateObj->setTimezone(Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE));
             //set date with applying timezone of store
             $dateObj->set($date, $this->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), $locale);
             //convert store date to default date in UTC timezone without DST
             $dateObj->setTimezone(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
             return $dateObj;
         } catch (Exception $e) {
             return null;
         }
     }
     return parent::_convertDate($date, $locale);
 }
Exemple #2
0
 protected function _convertDate($date, $locale)
 {
     if ($this->getColumn()->getFilterTime()) {
         try {
             if (Mage::app()->getLocale()->getLocale() == 'fa_IR') {
                 require_once Mage::getBaseDir('lib') . '/pdate/pdate.php';
                 list($j_y, $j_m, $j_d) = explode('/', $date);
                 $gregorianlArray = jalali_to_gregorian($j_y, $j_m, $j_d);
                 $date = implode('/', $gregorianlArray);
             }
             $dateObj = $this->getLocale()->date(null, null, $locale, false);
             //set default timezone for store (admin)
             $dateObj->setTimezone(Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE));
             //set date with applying timezone of store
             $dateObj->set($date, $this->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), $locale);
             //convert store date to default date in UTC timezone without DST
             $dateObj->setTimezone(Mage_Core_Model_Locale::DEFAULT_TIMEZONE);
             return $dateObj;
         } catch (Exception $e) {
             return null;
         }
     }
     return parent::_convertDate($date, $locale);
 }