JRGandara Posted May 9, 2011 Share Posted May 9, 2011 Hello!I wondering why my Prestashop date format looks like this:2011-05-09 instead 09-05-2011 (Brazilian format) or even 05-09-2011 (USA Format)I need to fix this. I searched all the tabs in BO and found nothing. Can someone tell me where is this configuration setup?Thanks in advance.JR Link to comment Share on other sites More sharing options...
DevNet Posted May 9, 2011 Share Posted May 9, 2011 Hi,If your iso country code for brazil is : "br", you can change the display date in the /classes/Tools.php classe, like this :Replace public static function displayDate($date, $id_lang, $full = false, $separator='-') { if (!$date OR !strtotime($date)) return $date; if (!Validate::isDate($date) OR !Validate::isBool($full)) die (self::displayError('Invalid date')); $tmpTab = explode($separator, substr($date, 0, 10)); $hour = ' '.substr($date, -8); $language = Language::getLanguage((int)($id_lang)); if ($language AND strtolower($language['iso_code']) == 'fr') return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : '')); else return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : '')); } to : public static function displayDate($date, $id_lang, $full = false, $separator='-') { if (!$date OR !strtotime($date)) return $date; if (!Validate::isDate($date) OR !Validate::isBool($full)) die (self::displayError('Invalid date')); $tmpTab = explode($separator, substr($date, 0, 10)); $hour = ' '.substr($date, -8); $language = Language::getLanguage((int)($id_lang)); if ($language AND strtolower($language['iso_code']) == 'fr') return ($tmpTab[2].'-'.$tmpTab[1].'-'.$tmpTab[0].($full ? $hour : '')); elseif ($language AND strtolower($language['iso_code']) == 'br') return ($tmpTab[1].'-'.$tmpTab[2].'-'.$tmpTab[0].($full ? $hour : '')); else return ($tmpTab[0].'-'.$tmpTab[1].'-'.$tmpTab[2].($full ? $hour : '')); } I've no tested.Regards Link to comment Share on other sites More sharing options...
JRGandara Posted May 9, 2011 Author Share Posted May 9, 2011 DVNet,Thank you! Reading your code I just tried to change from "fr" to "br" and swapped the tab numbers and work as should. I wondering why this is not in BO for easy configuration. Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts