Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Feb 2015
    Location
    UK
    Posts
    143
    Plugin Contributions
    0

    Default Changing the Date Format to UK

    Hi All,

    just starting to build a new site using 1.5.5a and am having difficulty changing the date format to the UK style on the site in general and on the admin pages, any advice welcome.

    It seemed to work Ok on 1.5.4......

    Michael

  2. #2
    Join Date
    Dec 2009
    Location
    Amersfoort, The Netherlands
    Posts
    2,846
    Plugin Contributions
    25

    Default Re: Changing the Date Format to UK

    You can change them in both your english.php files (one in admin, and one in shop side).

    Around line #20 you should see somthing like this
    PHP 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('PHP_DATE_TIME_FORMAT''m/d/Y H:i:s'); // this is used for date()
    define('DATE_TIME_FORMAT'DATE_FORMAT_SHORT ' %H:%M:%S');
    define('DATE_FORMAT_SPIFFYCAL''MM/dd/yyyy');  //Use only 'dd', 'MM' and 'yyyy' here in any order
    define('ADMIN_NAV_DATE_TIME_FORMAT''%A %d %b %Y %X'); // this is used for strftime() 

  3. #3
    Join Date
    Feb 2015
    Location
    UK
    Posts
    143
    Plugin Contributions
    0

    Default Re: Changing the Date Format to UK

    Thanks, just found my mistake in not changing one of the lines of code Doh !

    Michael

  4. #4
    Join Date
    Jan 2015
    Location
    Cyprus
    Posts
    46
    Plugin Contributions
    0

    Default Re: Changing the Date Format to UK

    Hi Guys,
    Can someone advise what may be wrong with the changes below for UK date format. The changes break the admin totally. Version 1.5.5f
    Thanks,
    George

    <?php
    /**
    * @package admin
    * @copyright Copyright 2003-2016 Zen Cart Development Team
    * @copyright Portions Copyright 2003 osCommerce
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: Author: DrByte Wed Mar 23 14:21:26 2016 -0500 Modified in v1.5.5 $
    */
    if (!defined('IS_ADMIN_FLAG'))
    {
    die('Illegal Access');
    }

    // added defines for header alt and text
    define('HEADER_ALT_TEXT', 'Admin Powered by Zen Cart :: The Art of E-Commerce');
    define('HEADER_LOGO_WIDTH', '200px');
    define('HEADER_LOGO_HEIGHT', '70px');
    define('HEADER_LOGO_IMAGE', 'logo.gif');

    // look in your $PATH_LOCALE/locale directory for available locales..
    $locales = array('en_GB', 'en_GB.utf8', 'en', ‘English_United Kingdom.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('PHP_DATE_TIME_FORMAT', ‘d/m/Y H:i:s'); // this is used for date()
    define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
    define('DATE_FORMAT_SPIFFYCAL', ‘dd/MM/yyyy'); //Use only 'dd', 'MM' and 'yyyy' here in any order
    define('ADMIN_NAV_DATE_TIME_FORMAT', '%A %d %b %Y %X'); // this is used for strftime()
    ////
    // Return date in raw format
    // $date should be in format dd/mm/yyyy
    // raw date is in format YYYYMMDD, or DDMMYYYY
    function zen_date_raw($date, $reverse = false) {
    if ($reverse) {
    return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);
    } else {
    return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);
    }
    }

  5. #5
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Changing the Date Format to UK

    Maybe I'm slow today or its not obvious, but the FAQ to accomplish this is: https://www.zen-cart.com/content.php...-to-dd-mm-yyyy

    If that doesn't work for you, then perhaps can explain where things go/went wrong.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: Changing the Date Format to UK

    @Georgecy, you've apparently edited that file using WordPress or some other non-ASCII editor. The issue is that you've got left- and right-single-quotes instead of just plain-old quotes in those definitions.

    You'll need to change the highlighted characters in your original file
    Code:

    // look in your $PATH_LOCALE/locale directory for available locales..
    $locales = array('en_GB', 'en_GB.utf8', 'en', English_United Kingdom.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('PHP_DATE_TIME_FORMAT', d/m/Y H:i:s'); // this is used for date()
    define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
    define('DATE_FORMAT_SPIFFYCAL', dd/MM/yyyy'); //Use only 'dd', 'MM' and 'yyyy' here in any order
    define('ADMIN_NAV_DATE_TIME_FORMAT', '%A %d %b %Y %X'); // this is used for strftime()

    to
    Code:

    // look in your $PATH_LOCALE/locale directory for available locales..
    $locales = array('en_GB', 'en_GB.utf8', 'en', 'English_United Kingdom.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('PHP_DATE_TIME_FORMAT', 'd/m/Y H:i:s'); // this is used for date()
    define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
    define('DATE_FORMAT_SPIFFYCAL', 'dd/MM/yyyy'); //Use only 'dd', 'MM' and 'yyyy' here in any order
    define('ADMIN_NAV_DATE_TIME_FORMAT', '%A %d %b %Y %X'); // this is used for strftime()




  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,488
    Plugin Contributions
    88

    Default Re: Changing the Date Format to UK

    @Georgecy, you've apparently edited that file using WordPress or some other non-ASCII editor. The issue is that you've got left- and right-single-quotes instead of just plain-old quotes in those definitions.

    You'll need to change the highlighted characters in your original file

    Code:
    // look in your $PATH_LOCALE/locale directory for available locales..
    $locales = array('en_GB', 'en_GB.utf8', 'en', English_United Kingdom.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('PHP_DATE_TIME_FORMAT', d/m/Y H:i:s'); // this is used for date()
    define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
    define('DATE_FORMAT_SPIFFYCAL', dd/MM/yyyy'); //Use only 'dd', 'MM' and 'yyyy' here in any order
    define('ADMIN_NAV_DATE_TIME_FORMAT', '%A %d %b %Y %X'); // this is used for strftime()
    to

    Code:
    // look in your $PATH_LOCALE/locale directory for available locales..
    $locales = array('en_GB', 'en_GB.utf8', 'en', 'English_United Kingdom.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('PHP_DATE_TIME_FORMAT', 'd/m/Y H:i:s'); // this is used for date()
    define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');
    define('DATE_FORMAT_SPIFFYCAL', 'dd/MM/yyyy'); //Use only 'dd', 'MM' and 'yyyy' here in any order
    define('ADMIN_NAV_DATE_TIME_FORMAT', '%A %d %b %Y %X'); // this is used for strftime()

  8. #8
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,589
    Plugin Contributions
    30

    Default Re: Changing the Date Format to UK

    Zen Cart 156b vanilla allows DOB to be entered 05/21/1970 or 21-05-1970.
    https://github.com/zencart/zencart/c...02f506c1f877f4

    How does that sit with the changes detailed here/in the FAQ...which does require updating to utf-8 anyway:

    https://www.zen-cart.com/content.php...-to-dd-mm-yyyy
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  9. #9
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Changing the Date Format to UK

    Quote Originally Posted by torvista View Post
    Zen Cart 156b vanilla allows DOB to be entered 05/21/1970 or 21-05-1970.
    https://github.com/zencart/zencart/c...02f506c1f877f4

    How does that sit with the changes detailed here/in the FAQ...which does require updating to utf-8 anyway:

    https://www.zen-cart.com/content.php...-to-dd-mm-yyyy
    The default (pre-change to "UK" format) recommendation is: MM/DD/YYYY or YYYY-MM-DD. The first is sleuthed out by evaluation of the zen_date_raw function results which should smoothly transition when changes are made per the above guidance. The second format is how javascript presents dates regardless of locale. The use of dashes is for an example as actually, the date could be entered in the sequence of the second example with dashes (-), forward slashes (/), or all compressed together with no separation.

    This modification is the same as was made previously for create_account, although this time the help text was updated to notify the customer of the options since a date picker is not necessarily forced on the user and not all such date pickers will leave the content in the format of the locale.

    So if create_account went well in Zen Cart 1.5.6 or 1.5.6a, then this additional change for account_edit will perform the same.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Changing the Date Format to UK

    Quote Originally Posted by torvista View Post
    Zen Cart 156b vanilla allows DOB to be entered 05/21/1970 or 21-05-1970.
    https://github.com/zencart/zencart/c...02f506c1f877f4

    How does that sit with the changes detailed here/in the FAQ...which does require updating to utf-8 anyway:

    https://www.zen-cart.com/content.php...-to-dd-mm-yyyy
    Quote Originally Posted by mc12345678 View Post
    The default (pre-change to "UK" format) recommendation is: MM/DD/YYYY or YYYY-MM-DD. The first is sleuthed out by evaluation of the zen_date_raw function results which should smoothly transition when changes are made per the above guidance. The second format is how javascript presents dates regardless of locale. The use of dashes is for an example as actually, the date could be entered in the sequence of the second example with dashes (-), forward slashes (/), or all compressed together with no separation.

    This modification is the same as was made previously for create_account, although this time the help text was updated to notify the customer of the options since a date picker is not necessarily forced on the user and not all such date pickers will leave the content in the format of the locale.

    So if create_account went well in Zen Cart 1.5.6 or 1.5.6a, then this additional change for account_edit will perform the same.
    All that said, looking at the guidance provided from the perspective following along word-for-word there certainly is a discrepancy. Perhaps the instructions could be slightly relaxed in the area describing what to change associated with the language defines to search for the date as specifically provided and to be replaced with the date in the desired format. This is instead of searching for the entire line and replacing with the entire line.

    Yes an alternative would be to undo the text modification, though that seems to me to be a step in the wrong direction. Otherwise, seems like some modification otherwise could be made to accomodate those that seek perfection.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v154 Changing Date Format in 1.54 to UK
    By nigelt74 in forum General Questions
    Replies: 5
    Last Post: 20 Jul 2015, 12:18 PM
  2. Changing the date format from US to UK i.e mmddyyyy to ddmmyyyy
    By alwayslearning in forum Basic Configuration
    Replies: 9
    Last Post: 4 Nov 2011, 12:56 AM
  3. Changing the DOB date format customers to use DDMMYYYY
    By shocker in forum Addon Language Packs
    Replies: 4
    Last Post: 27 Nov 2008, 01:09 PM
  4. 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