{"id":40739,"date":"2015-02-13T03:06:28","date_gmt":"2015-02-13T08:06:28","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=40739"},"modified":"2015-02-13T03:06:28","modified_gmt":"2015-02-13T08:06:28","slug":"zencart-how-to-change-date-format","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/zencart-how-to-change-date-format.html","title":{"rendered":"ZenCart. How to change dates format"},"content":{"rendered":"<p>This tutorial will show you how to change the default date US format (month\/day\/year) to European (day\/month\/year) in ZenCart.<\/p>\r\n\r\n<a href=\"http:\/\/www.youtube.com\/watch?v=sDOYjKhIqDI?width=1280&amp;height=720\" rel=\"prettyPhoto\">ZenCart. How to change dates from US format to European (day\/month\/year)<\/a>\r\n\r\n<a href=\"\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear1.jpg.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear1.jpg-300x130.jpg\" alt=\"ZenCart. How to change dates from US format to European (daymonthyear)1.jpg\" width=\"300\" height=\"130\" class=\"aligncenter size-medium wp-image-40749\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear1.jpg-300x130.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear1.jpg-150x65.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear1.jpg.jpg 657w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<p>We&#8217;ll edit two Zen Cart language files to make this change.<\/p>\r\n<ol>\r\n<li>\r\n  <p>Go to ZenCart installation root and open <strong>includes\/languages\/your-language.php<\/strong> file (if this file doesn&#8217;t exist, create it by copying the file <strong>admin\/includes\/languages\/your-language.php<\/strong> to this location) and find this section:<\/p>\r\n  <pre>@setlocale(LC_TIME, 'en_US');\r\ndefine('DATE_FORMAT_SHORT', '%m\/%d\/%Y'); \/\/ this is used for strftime()\r\ndefine('DATE_FORMAT_LONG', '%A %d %B, %Y'); \/\/ this is used for strftime()\r\ndefine('DATE_FORMAT', 'm\/d\/Y'); \/\/ this is used for date()\r\ndefine('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');<\/pre>\r\n<p>replace it with the following:<\/p>\r\n<pre class=\"brush:php\">@setlocale(LC_TIME, 'en_GB');\r\ndefine('DATE_FORMAT_SHORT', '%d\/%m\/%Y'); \/\/ this is used for strftime()\r\ndefine('DATE_FORMAT_LONG', '%A %d %B, %Y'); \/\/ this is used for strftime()\r\ndefine('DATE_FORMAT', 'd\/m\/Y'); \/\/ this is used for date()\r\ndefine('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');<\/pre><\/li>\r\n<li>in the same file find this section:\r\n<pre class=\"brush:php\">\/\/ Return date in raw format\r\n\/\/ $date should be in format mm\/dd\/yyyy\r\n\/\/ raw date is in format YYYYMMDD, or DDMMYYYY\r\nif (!function_exists('zen_date_raw')) {\r\n\u00a0 function zen_date_raw($date, $reverse = false) {\r\n\u00a0\u00a0\u00a0 if ($reverse) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 return substr($date, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);\r\n\u00a0\u00a0\u00a0 } else {\r\n\u00a0 \u00a0\u00a0 return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0 }\r\n}<\/pre> \r\n<p>and replace with the following:<\/p>\r\n<pre class=\"brush:php\"> \/\/ Return date in raw format\r\n\/\/ $date should be in format dd\/mm\/yyyy\r\n\/\/ raw date is in format YYYYMMDD, or DDMMYYYY\r\nif (!function_exists('zen_date_raw')) {\r\n\u00a0 function zen_date_raw($date, $reverse = false) {\r\n\u00a0\u00a0\u00a0 if ($reverse) {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);\r\n\u00a0\u00a0\u00a0 } else {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);\r\n\u00a0\u00a0\u00a0 }\r\n\u00a0 }\r\n}<\/pre><\/li>\r\n<li>In the same file find this section:\r\n<pre class=\"brush:php\">\/\/ text for date of birth example\r\ndefine('DOB_FORMAT_STRING', 'mm\/dd\/yyyy');<\/pre>\r\n<p>and replace with the following:<\/p>\r\n<pre class=\"brush:php\">\/\/ text for date of birth example\r\ndefine('DOB_FORMAT_STRING', 'dd\/mm\/yyyy');<\/pre><\/li>\r\n<li>In the same file find this section:\r\n<pre class=\"brush:php\">define('ENTRY_DATE_OF_BIRTH_ERROR', 'Is your birth date correct? Our system requires the date in this format: MM\/DD\/YYYY (eg 05\/21\/1970)');\r\ndefine('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 05\/21\/1970)');<\/pre>\r\n<p>and replace with the following:<\/p>\r\n<pre class=\"brush:php\">define('ENTRY_DATE_OF_BIRTH_ERROR', 'Is your birth date correct? Our system requires the date in this format: DD\/MM\/YYYY (eg 21\/05\/1970)');\r\ndefine('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 21\/05\/1970)');<\/pre><\/li>\r\n<li><p>Open <strong>admin\/includes\/languages\/your-language.php<\/strong> file.<\/p><\/li>\r\n<li><p>Find this section:<\/p>\r\n<pre class=\"brush:php\">setlocale(LC_TIME, 'en_US');\r\ndefine('DATE_FORMAT_SHORT', '%m\/%d\/%Y'); \/\/ this is used for strftime()\r\ndefine('DATE_FORMAT_LONG', '%A %d %B, %Y'); \/\/ this is used for strftime()\r\ndefine('DATE_FORMAT', 'm\/d\/Y'); \/\/ this is used for date()\r\ndefine('PHP_DATE_TIME_FORMAT', 'm\/d\/Y H:i:s'); \/\/ this is used for date()\r\ndefine('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');\r\ndefine('DATE_FORMAT_SPIFFYCAL', 'MM\/dd\/yyyy'); \/\/Use only 'dd', 'MM' and 'yyyy' here in any order<\/pre>\r\n<p>and replace with the following:<\/p>\r\n<pre class=\"brush:php\">setlocale(LC_TIME, 'en_GB');\r\ndefine('DATE_FORMAT_SHORT', '%d\/%m\/%Y'); \/\/ this is used for strftime()\r\ndefine('DATE_FORMAT_LONG', '%A %d %B, %Y'); \/\/ this is used for strftime()\r\ndefine('DATE_FORMAT', 'd\/m\/Y'); \/\/ this is used for date()\r\ndefine('PHP_DATE_TIME_FORMAT', 'd\/m\/Y H:i:s'); \/\/ this is used for date()\r\ndefine('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');\r\ndefine('DATE_FORMAT_SPIFFYCAL', 'dd\/MM\/yyyy'); \/\/Use only 'dd', 'MM' and 'yyyy' here in any order<\/pre><\/li>\r\n<li>In the same file find this section:\r\n<pre class=\"brush:php\">\/\/ Return date in raw format\r\n\/\/ $date should be in format mm\/dd\/yyyy\r\n\/\/ raw date is in format YYYYMMDD, or DDMMYYYY\r\nfunction zen_date_raw($date, $reverse = false) {\r\n  if ($reverse) {\r\n    return substr($date, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);\r\n  } else {\r\n    return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);\r\n  }\r\n}<\/pre>\r\n<p>and replace with the following:<\/p>\r\n<pre class=\"brush:php\">\/\/ Return date in raw format\r\n\/\/ $date should be in format dd\/mm\/yyyy\r\n\/\/ raw date is in format YYYYMMDD, or DDMMYYYY\r\nfunction zen_date_raw($date, $reverse = false) {\r\n  if ($reverse) {\r\n    return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);\r\n  } else {\r\n    return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);\r\n  }\r\n}<\/pre><\/li>\r\n<li>In the same file find this section:\r\n<pre class=\"brush:php\">\/\/ text for date of birth example\r\ndefine('DOB_FORMAT_STRING', 'mm\/dd\/yyyy');<\/pre>\r\n<p>and replace with the following:<\/p>\r\n<pre class=\"brush:php\">\/\/ text for date of birth example\r\ndefine('DOB_FORMAT_STRING', 'dd\/mm\/yyyy');<\/pre><\/li>\r\n<li>In the same file find this section:\r\n<pre class=\"brush:php\">define('JS_DOB', '* The \\'Date of Birth\\' entry must be in the format: xx\/xx\/xxxx (month\/date\/year).\\n');<\/pre>\r\n<p>and replace with the following:<\/p>\r\n<pre class=\"brush:php\">define('JS_DOB', '* The \\'Date of Birth\\' entry must be in the format: xx\/xx\/xxxx (date\/month\/year).\\n');<\/pre><\/li>\r\n<li>In the same file find this section:\r\n<pre class=\"brush:php\">define('ENTRY_DATE_OF_BIRTH_ERROR', '&amp;nbsp;&lt;span class=&quot;errorText&quot;&gt;(eg. 05\/21\/1970)&lt;\/span&gt;');<\/pre>\r\n<p>and replace with the following:<\/p>\r\n<pre class=\"brush:php\">define('ENTRY_DATE_OF_BIRTH_ERROR', '&amp;nbsp;&lt;span class=&quot;errorText&quot;&gt;(eg. 21\/05\/1970)&lt;\/span&gt;');<\/pre>\r\n<p>Done! That\u2019s all! Now all dates on your site will be displayed in European format.<\/p>\r\n\r\n<a href=\"\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear2.jpg.jpg\"><img loading=\"lazy\" src=\"\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear2.jpg-300x117.jpg\" alt=\"ZenCart. How to change dates from US format to European (daymonthyear)2.jpg\" width=\"300\" height=\"117\" class=\"aligncenter size-medium wp-image-40748\" srcset=\"https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear2.jpg-300x117.jpg 300w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear2.jpg-150x58.jpg 150w, https:\/\/www.templatemonster.com\/help\/wp-content\/uploads\/2014\/11\/ZenCart.-How-to-change-dates-from-US-format-to-European-daymonthyear2.jpg.jpg 741w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>\r\n<\/li>\r\n<\/ol>\r\n<p>Feel free to check the detailed video tutorial below:<\/p>\r\n\r\n<a href=\"http:\/\/www.youtube.com\/watch?v=sDOYjKhIqDI?width=1280&amp;height=720\" rel=\"prettyPhoto\">ZenCart. How to change dates from US format to European (day\/month\/year)<\/a>","protected":false},"excerpt":{"rendered":"<p>This tutorial will show you how to change the default date US format (month\/day\/year) to European (day\/month\/year) in ZenCart.<\/p>\n","protected":false},"author":61,"featured_media":43748,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[734],"tags":[843,804,2408],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/40739"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/61"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=40739"}],"version-history":[{"count":0,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/40739\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/43748"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=40739"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=40739"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=40739"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}