Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2008
    Location
    Sydney Australia
    Posts
    816
    Plugin Contributions
    0

    Default Change Date Format

    Hi all,

    Setting up a local copy of version 2.1.0 zencart and just wanting to now how I change the date format from US to UK date format.

    I tried to change three files which are replaced with:

    admin /includes/languages/lang.english.php

    @setlocale(LC_TIME, ['en_AU', 'en_AU.utf8', 'en', 'English_Australia.1252']);


    /includes/languages/lang.english.php

    global $locales;
    $locales = ['en_AU', 'en_AU.utf8', 'en', 'English_Australia.1252'];
    @setlocale(LC_TIME, $locales);


    /includes/extra_configures/set_time_zone.php

    $TZ = time zone = 'Australia/Brisbane';

    Could anyone tell me what I have done wrong because the dates are still US format.
    Outdoorking
    Live Site www.outdoorking.com.au

  2. #2
    Join Date
    Apr 2008
    Location
    Qld, Australia
    Posts
    351
    Plugin Contributions
    6

    Default Re: Change Date Format

    In admin you should have the file "includes/extra_configures/use_catalog_time_zone.php" which has one active line
    Code:
    include (DIR_FS_CATALOG . '/includes/extra_configures/set_time_zone.php');
    In the catalog you should have the file "includes/extra_configures/set_time_zone.php" which will have the first active line as
    Code:
      $TZ = 'Australia/Brisbane';

    In language definitions for your template eg in "\includes\languages\english\extra_definitions\bmh_bootstrap_377" you should have a "lang.english.php" file for any overides of default language definitions. So I have
    Code:
     
    global $locales;
    $locales = ['en_AU', 'en_AU.utf8mb4', 'en', 'English_Australia.1252'];
    
    
    @setlocale(LC_TIME, $locales);
    
    $define = [
        'DATE_FORMAT' => 'd/m/Y', // 
        'DATE_FORMAT_LONG' => '%A %d %B, %Y', //  
        'DOB_FORMAT_STRING' => 'dd/mm/yyyy',  //  
        '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) or this format: YYYY-MM-DD (eg 1970-05-21)', //
        'ENTRY_DATE_OF_BIRTH_TEXT' => '* (eg. 21/05/1970 or 1970-05-21)', // 
        'LANGUAGE_CURRENCY' => 'AUD', // BMH
    (this is only a part of the file contents)
    OldNGrey
    ZC158a PHP 8.2.15
    MySQL 10.6.16-MariaDB

  3. #3
    Join Date
    Aug 2008
    Location
    Sydney Australia
    Posts
    816
    Plugin Contributions
    0

    Default Re: Change Date Format

    Hi OldNGrey,

    Thans for that but I am unable to locate this one file you quoted in the location stated.

    In language definitions for your template eg in "\includes\languages\english\extra_definitions\bmh_bootstrap_377" you should have a "lang.english.php" file for any overides of default language definitions. So I have

    The file "\includes\languages\lang.english.php was the only one that I could locate but when changed the front page went blank.

    Note that this is a clean install of 2.1.0 and at this stage I only have a couple of issues which is the time format and the numinix module.

    Once these are corrected I should be able to go live and then find out what else is wrong but so fare no majour issues.
    Outdoorking
    Live Site www.outdoorking.com.au

  4. #4
    Join Date
    Aug 2008
    Location
    Sydney Australia
    Posts
    816
    Plugin Contributions
    0

    Default Re: Change Date Format

    Erro message that I am getting after the two files are changed:
    [01-Nov-2025 22:45:39 Australia/Sydney] PHP Parse error: syntax error, unexpected token ";", expecting "]" in C:\xampp\htdocs\outdoorking.com\includes\languages\lang.english.php on line 542

    [01-Nov-2025 22:45:39 Australia/Sydney] Request URI: /outdoorking.com/, IP address: 127.0.0.1
    --> PHP Parse error: syntax error, unexpected token ";", expecting "]" in C:\xampp\htdocs\outdoorking.com\includes\languages\lang.english.php on line 542.

    [01-Nov-2025 22:45:39 Australia/Sydney] Request URI: /outdoorking.com/, IP address: 127.0.0.1
    --> PHP Parse error: syntax error, unexpected token ";", expecting "]" in C:\xampp\htdocs\outdoorking.com\includes\languages\lang.english.php on line 542.
    Outdoorking
    Live Site www.outdoorking.com.au

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,686
    Plugin Contributions
    95

    Default Re: Change Date Format

    Quote Originally Posted by Bruce1952 View Post
    Erro message that I am getting after the two files are changed:
    [01-Nov-2025 22:45:39 Australia/Sydney] PHP Parse error: syntax error, unexpected token ";", expecting "]" in C:\xampp\htdocs\outdoorking.com\includes\languages\lang.english.php on line 542

    [01-Nov-2025 22:45:39 Australia/Sydney] Request URI: /outdoorking.com/, IP address: 127.0.0.1
    --> PHP Parse error: syntax error, unexpected token ";", expecting "]" in C:\xampp\htdocs\outdoorking.com\includes\languages\lang.english.php on line 542.

    [01-Nov-2025 22:45:39 Australia/Sydney] Request URI: /outdoorking.com/, IP address: 127.0.0.1
    --> PHP Parse error: syntax error, unexpected token ";", expecting "]" in C:\xampp\htdocs\outdoorking.com\includes\languages\lang.english.php on line 542.
    Some update you made has borked /includes/languages/lang.english.php (a core file, which you should have overridden with a template override, anyway). Look at line 542 of that file to see where you've made that error.

  6. #6
    Join Date
    Aug 2008
    Location
    Sydney Australia
    Posts
    816
    Plugin Contributions
    0

    Default Re: Change Date Format

    Quote Originally Posted by lat9 View Post
    Some update you made has borked /includes/languages/lang.english.php (a core file, which you should have overridden with a template override, anyway). Look at line 542 of that file to see where you've made that error.
    This is what is in the file from line 530 to line 546
    'TEXT_TOTAL_AMOUNT' => '  Amount: ',
    'TEXT_TOTAL_ITEMS' => 'Total Items: ',
    'TEXT_TOTAL_WEIGHT' => '  Weight: ',
    'TEXT_UNKNOWN_TAX_RATE' => 'Sales Tax',
    'TEXT_VALID_COUPON' => 'Congratulations you have redeemed the Discount Coupon',
    'TEXT_WORDS_FREE' => ' Word(s) free ',
    'TEXT_YOUR_IP_ADDRESS' => 'Your IP Address is: ',
    'TYPE_BELOW' => 'Type a choice below ...',
    'WARNING_COULD_NOT_LOCATE_LANG_FILE' => 'WARNING: Could not locate language file: ',
    'WARNING_NO_FILE_UPLOADED' => 'Warning: no file uploaded.',
    'WARNING_PRODUCT_QUANTITY_ADJUSTED' => 'Quantity has been adjusted to what is in stock. ',
    'WARNING_SHOPPING_CART_COMBINED' => 'NOTICE: For your convenience, your current shopping cart has been combined with your shopping cart from your last visit. Please review your shopping cart before checking out.',
    ];

    // Definitions that require references to other definitions
    $define['ATTRIBUTES_QTY_PRICE_SYMBOL'] = zen_image(DIR_WS_TEMPLATE_ICONS . 'icon_status_green.gif', $define['TEXT_ATTRIBUTES_QTY_PRICE_HELP_LINK'], 10, 10) . ' ';
    $define['BOX_HEADING_GIFT_VOUCHER'] = $define['TEXT_GV_NAME'] . ' Account';

    Also the begining of the file line 7 to 22

    global $locales;
    $locales = ['en_AU', 'en_AU.utf8mb4', 'en', 'English_Australia.1252'];


    @setlocale(LC_TIME, $locales);

    $define = [
    'DATE_FORMAT' => 'd/m/Y', //
    'DATE_FORMAT_LONG' => '%A %d %B, %Y', //
    'DOB_FORMAT_STRING' => 'dd/mm/yyyy', //
    '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) or this format: YYYY-MM-DD (eg 1970-05-21)', //
    'ENTRY_DATE_OF_BIRTH_TEXT' => '* (eg. 21/05/1970 or 1970-05-21)', //
    'LANGUAGE_CURRENCY' => 'AUD', // BMH


    $define = [
    Outdoorking
    Live Site www.outdoorking.com.au

  7. #7
    Join Date
    Apr 2006
    Location
    West Salem, IL
    Posts
    2,861
    Plugin Contributions
    0

    Default Re: Change Date Format

    from what you posted, why is there a
    Code:
    $define = [
    at what I assume is line 22?
    Mike
    AEIIA - Zen Cart Certified & PCI Compliant Hosting
    The Zen Cart Forum...Better than a monitor covered with post-it notes!

  8. #8
    Join Date
    Aug 2008
    Location
    Sydney Australia
    Posts
    816
    Plugin Contributions
    0

    Default Re: Change Date Format

    Hi Barco57,

    Thanks for the reply.

    Are you saying that I should remove $define = [
    to see if that fixes the issue or do you want more information regarding the code.
    Outdoorking
    Live Site www.outdoorking.com.au

  9. #9
    Join Date
    Apr 2006
    Location
    West Salem, IL
    Posts
    2,861
    Plugin Contributions
    0

    Default Re: Change Date Format

    attach the entire file
    Mike
    AEIIA - Zen Cart Certified & PCI Compliant Hosting
    The Zen Cart Forum...Better than a monitor covered with post-it notes!

  10. #10
    Join Date
    Aug 2008
    Location
    Sydney Australia
    Posts
    816
    Plugin Contributions
    0

    Default Re: Change Date Format

    Quote Originally Posted by barco57 View Post
    attach the entire file
    set_time_zone.php
    <?php
    /**
    * @copyright Copyright 2003-2024 Zen Cart Development Team
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: DrByte 2023 Aug 27 Modified in v2.0.0-alpha1 $
    */
    /*
    * Set time zone
    */
    // put your timezone here. Refer to http://www.php.net/manual/en/timezones.php
    $TZ = 'Australia/Sydney';



    /**
    * MAKE NO CHANGES BELOW THIS LINE
    *
    * The following will take the timezone you specified above and apply it in your store.
    * If you didn't specify one, it will try to use the setting from your server's PHP configuration
    */
    if (empty($TZ)) {
    $TZ = date_default_timezone_get();
    } else {
    putenv('TZ=' . $TZ);
    @date_default_timezone_set($TZ);
    }

    // Now incorporate TZ change into log filenames
    zen_set_error_logging_filename();

    Lang.english.php
    <?php
    // -----
    // Since the languages are now loaded via classes, the $locales definition
    // needs to be globalized for use in payment-methods (e.g. paypalwpp) and
    // other processing.
    //
    global $locales;
    $locales = ['en_US', 'en_US.utf8', 'en', 'English_United States.1252'];
    @setlocale(LC_TIME, $locales);

    $define = [
    'ARIA_DELETE_ITEM_FROM_CART' => 'Delete this item from the cart',
    'ARIA_EDIT_QTY_IN_CART' => 'Edit quantity in cart',
    'ARIA_PAGINATION_' => '',
    'ARIA_PAGINATION_CURRENTLY_ON' => ', now on page %s',
    'ARIA_PAGINATION_CURRENT_PAGE' => 'Current Page',

    Unbale to upload the complete file here.
    Outdoorking
    Live Site www.outdoorking.com.au

 

 

Similar Threads

  1. Change date format
    By gpone12 in forum Basic Configuration
    Replies: 6
    Last Post: 5 Jul 2012, 01:29 AM

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