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'] = ' <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.:D
Re: 158 Date format changing to UK in admin
Quote:
Originally Posted by
Valencia
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'] = ' <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.:D
The code above should actually read as follows, I am just no good at cut and paste with the forum stuff! :blush:
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'] = ' <span class="errorText">(eg. 21/05/1970)</span>';
$define['PHP_DATE_TIME_FORMAT'] = 'd/m/Y H:i:s';
return $define;
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' => ' <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.
Re: 158 Date format changing to UK in admin
Quote:
Originally Posted by
OldNGrey
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' => ' <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. :D
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/ :unsure: