Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2010
    Location
    England
    Posts
    17
    Plugin Contributions
    0

    Default 158 Date format changing to UK in admin

    Hi,

    Current setup
    ZC 158
    PHP 7.4
    Bootstrap 4
    OPC

    I am implementing the usual language file changes required to change the date format mm/dd/yyyy to the dd/mm/yyyy.
    Following the instructions on the Zen Cart docs pages for 158 it is very similar to the setup for 157 except the changes to the includes/functions/functions_dates.php file (very straight forward) and the admin/includes/languages/extra_definitions/lang.admin_overrides.php.
    I created the lang.admin_overrides.php file as it wasn't already in my file structure and added the following as per instructions

    Code:
    <?php@setlocale(LC_TIME, ['en_GB', 'en_GB.utf8', 'en']);
    
    
    $define['DATE_FORMAT'] = 'd/m/Y';
    $define['DATE_FORMAT_SHORT'] = '%d/%m/%Y';
    $define['DATE_FORMAT_SPIFFYCAL'] = 'dd/MM/yyyy';
    $define['ENTRY_DATE_OF_BIRTH_ERROR'] = '&nbsp;<span class="errorText">(eg. 21/05/1970)</span>';
    $define['PHP_DATE_TIME_FORMAT'] = 'd/m/Y H:i:s';
    
    
    return $define;
    This method did not change any of my admin date stamps, the only way to get the dates to be in the correct UK format was to change the info in admin/includes/languages/lang.english.php and find and change the @setlocal and $define lines in there.
    Last edited by Valencia; 28 Feb 2023 at 10:27 PM.
    Top Quality Belgian Chocolates and Continental Confectionery.
    https://www.sweetmomentsuk.co.uk

  2. #2
    Join Date
    Jul 2010
    Location
    England
    Posts
    17
    Plugin Contributions
    0

    Default Re: 158 Date format changing to UK in admin

    Quote Originally Posted by Valencia View Post
    Hi,

    Current setup
    ZC 158
    PHP 7.4
    Bootstrap 4
    OPC

    I am implementing the usual language file changes required to change the date format mm/dd/yyyy to the dd/mm/yyyy.
    Following the instructions on the Zen Cart docs pages for 158 it is very similar to the setup for 157 except the changes to the includes/functions/functions_dates.php file (very straight forward) and the admin/includes/languages/extra_definitions/lang.admin_overrides.php.
    I created the lang.admin_overrides.php file as it wasn't already in my file structure and added the following as per instructions

    Code:
    <?php@setlocale(LC_TIME, ['en_GB', 'en_GB.utf8', 'en']);
    
    
    $define['DATE_FORMAT'] = 'd/m/Y';
    $define['DATE_FORMAT_SHORT'] = '%d/%m/%Y';
    $define['DATE_FORMAT_SPIFFYCAL'] = 'dd/MM/yyyy';
    $define['ENTRY_DATE_OF_BIRTH_ERROR'] = '&nbsp;<span class="errorText">(eg. 21/05/1970)</span>';
    $define['PHP_DATE_TIME_FORMAT'] = 'd/m/Y H:i:s';
    
    
    return $define;
    This method did not change any of my admin date stamps, the only way to get the dates to be in the correct UK format was to change the info in admin/includes/languages/lang.english.php and find and change the @setlocal and $define lines in there.
    The code above should actually read as follows, I am just no good at cut and paste with the forum stuff!

    Code:
    <?php
    
    @setlocale(LC_TIME, ['en_GB', 'en_GB.utf8', 'en']);
    
    
    $define['DATE_FORMAT'] = 'd/m/Y';
    $define['DATE_FORMAT_SHORT'] = '%d/%m/%Y';
    $define['DATE_FORMAT_SPIFFYCAL'] = 'dd/MM/yyyy';
    $define['ENTRY_DATE_OF_BIRTH_ERROR'] = '&nbsp;<span class="errorText">(eg. 21/05/1970)</span>';
    $define['PHP_DATE_TIME_FORMAT'] = 'd/m/Y H:i:s';
    
    
    return $define;
    Top Quality Belgian Chocolates and Continental Confectionery.
    https://www.sweetmomentsuk.co.uk

  3. #3
    Join Date
    Apr 2008
    Location
    Qld, Australia
    Posts
    309
    Plugin Contributions
    6

    Default Re: 158 Date format changing to UK in admin

    I have 2 files:
    \admin\includes\extra_configures\use_catalog_time_zone.php with content
    Code:
    <?php
    // get time zone settings from catalog-side file
    include (DIR_FS_CATALOG . '/includes/extra_configures/set_time_zone.php');
    and
    admin\includes\languages\lang.english.php with content
    Code:
    @setlocale(LC_TIME, ['en_AU', 'en_AU.utf8mb4', 'en', 'English_Australia.1252']); //NOTE last parameter is for Windows
    $define = [
    // various lines
        'DATE_FORMAT' => 'd/m/Y',  
        'DATE_FORMAT_DATE_PICKER' => 'yy-mm-dd',
        'DATE_FORMAT_LONG' => '%A %d %B, %Y',
        'DATE_FORMAT_SHORT' => '%d/%m/%Y', 
        'DATE_FORMAT_SPIFFYCAL' => 'dd/MM/yyyy', 
        'DATE_TIME_FORMAT' => '%%DATE_FORMAT_SHORT%%' . ' %H:%M:%S',
    // various lines
       'ENTRY_DATE_OF_BIRTH_ERROR' => '&nbsp;<span class="errorText">(eg. 21/05/1970)</span>',
    // various lines
        'PHP_DATE_TIME_FORMAT' => 'd/m/Y H:i:s',
    The $defines in your example may be a typo in transcribing or an incorrect format in the source file.

  4. #4
    Join Date
    Jul 2010
    Location
    England
    Posts
    17
    Plugin Contributions
    0

    Default Re: 158 Date format changing to UK in admin

    Quote Originally Posted by OldNGrey View Post
    I have 2 files:
    \admin\includes\extra_configures\use_catalog_time_zone.php with content
    Code:
    <?php
    // get time zone settings from catalog-side file
    include (DIR_FS_CATALOG . '/includes/extra_configures/set_time_zone.php');
    and
    admin\includes\languages\lang.english.php with content
    Code:
    @setlocale(LC_TIME, ['en_AU', 'en_AU.utf8mb4', 'en', 'English_Australia.1252']); //NOTE last parameter is for Windows
    $define = [
    // various lines
        'DATE_FORMAT' => 'd/m/Y',  
        'DATE_FORMAT_DATE_PICKER' => 'yy-mm-dd',
        'DATE_FORMAT_LONG' => '%A %d %B, %Y',
        'DATE_FORMAT_SHORT' => '%d/%m/%Y', 
        'DATE_FORMAT_SPIFFYCAL' => 'dd/MM/yyyy', 
        'DATE_TIME_FORMAT' => '%%DATE_FORMAT_SHORT%%' . ' %H:%M:%S',
    // various lines
       'ENTRY_DATE_OF_BIRTH_ERROR' => '&nbsp;<span class="errorText">(eg. 21/05/1970)</span>',
    // various lines
        'PHP_DATE_TIME_FORMAT' => 'd/m/Y H:i:s',
    The $defines in your example may be a typo in transcribing or an incorrect format in the source file.
    Thank you,

    That confirms what I thought, and modified my copy of admin\includes\languages\lang.english.php accordingly to reflect the changes necessary for here in the UK, much the same as for previous versions of my store.

    It was option 3 in the official Zen Cart Docs that gave me a bum steer, as seen in the link below.

    https://docs.zen-cart.com/user/local...g_date_format/
    Top Quality Belgian Chocolates and Continental Confectionery.
    https://www.sweetmomentsuk.co.uk

 

 

Similar Threads

  1. Replies: 4
    Last Post: 1 Apr 2021, 10:30 PM
  2. v155 Changing the Date Format to UK
    By Mikeondraco in forum General Questions
    Replies: 11
    Last Post: 29 May 2019, 10:52 AM
  3. 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
  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