Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default 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
    Webzings Design
    Semi retired from Web Design

  2. #2
    Join Date
    Sep 2008
    Location
    DownUnder, overlooking South Pole.
    Posts
    976
    Plugin Contributions
    6

    Default 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');

  3. #3
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Changing Date Format in 1.54 to UK

    Quote Originally Posted by nigelt74 View Post
    ...

    $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.
    Last edited by lhungil; 23 Apr 2015 at 06:10 PM. Reason: Add note for clarification.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,509
    Plugin Contributions
    88

    Default 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.

  5. #5
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Changing Date Format in 1.54 to UK

    Quote Originally Posted by lat9 View Post
    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
    Last edited by RodG; 19 Jul 2015 at 10:57 PM.

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,509
    Plugin Contributions
    88

    Default Re: Changing Date Format in 1.54 to UK

    Quote Originally Posted by RodG View Post
    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).

 

 

Similar Threads

  1. Changing date format from word to numbers.
    By thesinner in forum General Questions
    Replies: 1
    Last Post: 2 Aug 2010, 10:08 PM
  2. Changing Date to UK format
    By startrek in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 29 May 2007, 08:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR