Changing Date Format in 1.54 to UK
First off, i have changed the date format from US to the UK version many many times in older versions of zencart
https://www.zen-cart.com/showthread....he-Date-format
But in version 1.54 the specific block of code is slightly different and I don't really know why and what the effect of me changing it the way i used to would do
includes/languages/english.php
Old code
Code:
@setlocale(LC_TIME, 'en_US.ISO_8859-1');
define('DATE_FORMAT_SHORT', '%m/%d/%Y'); // this is used for strftime()
define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
define('DATE_FORMAT', 'm/d/Y'); // this is used for date()
define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
The new code
Code:
// look in your $PATH_LOCALE/locale directory for available locales..
$locales = array('en_US', 'en_US.utf8', 'en', 'English_United States.1252');
@setlocale(LC_TIME, $locales);
define('DATE_FORMAT_SHORT', '%m/%d/%Y'); // this is used for strftime()
define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
define('DATE_FORMAT', 'm/d/Y'); // this is used for date()
define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
The last 4 lines are identical in both, not a problem,
however it is the conversion of the first line in the old code
@setlocale(LC_TIME, 'en_US.ISO_8859-1');
that becomes two lines in the newer code, how do I Anglicise that
$locales = array('en_US', 'en_US.utf8', 'en', 'English_United States.1252');
@setlocale(LC_TIME, $locales);
becomes what in English UK , and will the change to UTF8 effect anything if my database has been imported from an older version
Thanks
Re: Changing Date Format in 1.54 to UK
These are my settings. The first two lines are unchanged and I have not found any problems to date. I do not recall when I made these changes but have carried much the same settings through from 139h.
Code:
// look in your $PATH_LOCALE/locale directory for available locales..
$locales = array('en_US', 'en_US.utf8', 'en', 'English_United States.1252');
@setlocale(LC_TIME, $locales);
define('DATE_FORMAT_SHORT', '%d/%m/%Y'); // this is used for strftime()
define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
define('DATE_FORMAT', 'd/m/Y'); // this is used for date()
define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
Re: Changing Date Format in 1.54 to UK
Quote:
Originally Posted by
nigelt74
...
$locales = array('en_US', 'en_US.utf8', 'en', 'English_United States.1252');
@setlocale(LC_TIME, $locales);
... becomes what in English UK ...
Depends on the server hosting your website and what locales are installed. Here are the typical ones for Linux / Windows servers... But if your server does not have support for ONE of these enabled, you may need to ask your hosting provider what locales are available for your use in PHP (or just use the US ones).
Code:
$locales = array('en_GB', 'en_GB.utf8', 'en', 'English_United Kingdom.1252');
@setlocale(LC_TIME, $locales);
NOTE: combine with what dw08gm posted.
Re: Changing Date Format in 1.54 to UK
Has anyone gotten the admin-level spiffyCal dates to get properly formatted when using a dd/mm/yyyy date format? I've applied all the other changes suggested in this thread as well as this (https://www.zen-cart.com/content.php...-to-dd-mm-yyyy) FAQ.
If, for example, I go to Catalog->Featured Products and display the entry for a product which is available on 30/05/2014 and ends on 24/06/2016, those dates are displayed properly in the calendar display but when I go to change the date, the calendar-entry defaults to the current month -- indicating that it's not "happy" with the date format.
If I choose a date from the calendar, the date displayed reverts to mm/dd/yyyy format which is also the format in which the data is posted back. The result is that 0000-00-00 is stored in the database because the date-formatting modifications create an invalid "raw" date, e.g. 20152406.
Re: Changing Date Format in 1.54 to UK
Quote:
Originally Posted by
lat9
Has anyone gotten the admin-level spiffyCal dates to get properly formatted when using a dd/mm/yyyy date format?
Although I don't recall ever changing this:
/admin/includes/javascript/spiffyCal/spiffyCal_v2_1.js
line#45 reads
this.defaultDateFormat="dd-MMM-yyyy"
I don't have the problem that you are describing, so perhaps this is something to check?
Also, I've just found /admin/includes/languages/english.php has a line that reads:
define('DATE_FORMAT_SPIFFYCAL', 'dd/MM/yyyy');
I suspect that this is the 'important' one.
Cheers
RodG
Re: Changing Date Format in 1.54 to UK
Quote:
Originally Posted by
RodG
Although I don't recall ever changing this:
/admin/includes/javascript/spiffyCal/spiffyCal_v2_1.js
line#45 reads
this.defaultDateFormat="dd-MMM-yyyy"
I don't have the problem that you are describing, so perhaps this is something to check?
Also, I've just found /admin/includes/languages/english.php has a line that reads:
define('DATE_FORMAT_SPIFFYCAL', 'dd/MM/yyyy');
I suspect that this is the 'important' one.
Cheers
RodG
Yep, it was that last one that did the trick! I thought I'd seen that define somewhere (after spending about an hour trolling through the javascript).