Hi
I'm VERY new to oscommerce and just have a small question
I'm trying to change the date of birth to english formated (when you create a new account).
ie to read 24/01/1923 in stead of 01/24/1923
Thanks
EnergeeUK
This is a discussion on Dat of birth problem within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; Hi I'm VERY new to oscommerce and just have a small question I'm trying to change the date of birth ...
Hi
I'm VERY new to oscommerce and just have a small question
I'm trying to change the date of birth to english formated (when you create a new account).
ie to read 24/01/1923 in stead of 01/24/1923
Thanks
EnergeeUK
php occurs in blocks surrounded by commenting. this commenting tells non programmers like you and me what each module of code is for. you would need to find the file that contains the date and just copy and paste them into the new order. ie change the order of the three modules. or they may be parts of one you wont know until you find the code.
there is an article that will get you up to speed in the oscdox at chapter three of the mod guide, exercise 1.
The date formats are defined in catalog\includes\languages\english.php
Open english.pphp for editing and search for DOB_FORMAT_STRING, JS_DOB, ENTRY_DATE_OF_BIRTH_ERROR, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_FORMAT
and change: setlocale(LC_TIME, 'en_US.ISO_8859-1');
to: setlocale(LC_TIME, 'en_GB.ISO_8859-1');
I am trying to do this but having problems interpreting define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
Not sure what %A or %B is
Originally Posted by NickW
Yes I did all this but its still returning an error even when I enter 01/01/1978 into the Date of Birth box. Could not locate JS_DOB in the code for english.php - does that matter. Could anyone show an example of the modified code for UK format date of birth entry.
I was hoping someone could deal with my posting about how to reform a date field from US to UK format. I have tried all the solutions that have already been posted, without success. So, where am I going wrong?
I have just done this today.Originally Posted by b2bcons
![]()
Edit catalog/includes/languages/english.php
Change the return statements as detailed below......
// Return date in raw format
// $date should be in format dd/mm/yyyy (changed from supplied default)
// raw date is in format YYYYMMDD, or DDMMYYYY
function tep_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);
}
}
Because the other settings where changed from mm/dd/yyyy to dd/mm/yyyy, you needed to change the statements shown to extract the day and month from the different positions in $date.
Seems to work ok for me. It gets me through the registration screen and it displays correctly when I look at my account details later.
Regards
Ian
Hi all.
I have successfully got the fix working. But the problem is with the admin page.
When I try to change the date of birth of a customer it's still in the MM/DD/YY format.
Also the "account created" date is in MM/DD/YY format.
Does any one have any ideas on how to fix the admin date format.
Cheers
I have fixed it.
You need to change the same stuff as the before.
Basically change to the following stuff
setlocale(LC_TIME, 'en_GB.ISO_8859-1');
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()
function tep_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);
}
}
define('DOB_FORMAT_STRING', 'dd/mm/yyyy');
define('ENTRY_DATE_OF_BIRTH_ERROR', '&nbsp;<span class="errorText">(eg. 21/05/1970)</span>');
Bookmarks