Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Date Format


OMalleys

Recommended Posts

I need to change the date of birth format to UK style dd/mm/yyyy

I have changed the format in includes/laguages/english.php

When I view customer details it now displays the dob in the UK format BUT when I try to set up a new customer account it still asks for the US format mm/dd/yyyy

Can anyone help - I have searched dozend of old threads but none seem to have the answer.

Thanks

Link to comment
Share on other sites

catalog/includes/languages/english.php around line 186

 

define('ENTRY_DATE_OF_BIRTH_ERROR', 'Your Date of Birth must be in this format: DD/MM/YYYY (eg 21/05/1970)');
define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 21/05/1970)');

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Thanks Steve you are a life saver - that has now fixed half of the problem:

 

I have looked for that code but can only find this:

define('ENTRY_DATE_OF_BIRTH', 'Date of Birth:');
define('ENTRY_DATE_OF_BIRTH_ERROR', ' <small><font color="#FF0000">(eg. 21/05/1970)</font></small>');
define('ENTRY_DATE_OF_BIRTH_TEXT', ' <small>(eg. 21/05/1970) <font color="#AABBDD">required</font></small>');

As you can see I have changed it - now the new account screen asks for the dob in the UK format (before the prompt showed US format ie. 05/21/1970) but it still throws an error unless it is input in US format??

Anyone any more ideas?

Link to comment
Share on other sites

have you also done the admin for dob ?

 

do you have this for catalog/includes/languages/english.php

 

@setlocale(LC_TIME, 'en_UK.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('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');

 

and this

 

// text for date of birth example
define('DOB_FORMAT_STRING', 'dd/mm/yyyy');

 

and this for admin/includes/languages/english.php

 

@setlocale(LC_TIME, 'en_UK.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()
define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S')

 

// text for date of birth example
define('DOB_FORMAT_STRING', 'dd/mm/yyyy');

 

define('JS_DOB', '* The \'Date of Birth\' entry must be in the format: xx/xx/xxxx (date/month/year).\n');

 

define('ENTRY_DATE_OF_BIRTH_ERROR', ' <span class="errorText">(eg. 05/21/1970)</span>');

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Thanks again Steve - I certainly appreciate your help.

I have checked all of the code you mentioned and it is all correct (the LC_TIME was set to US but I have now changed that)

However I cannot find one piece of code in admin/includes/languages/english.php

define('ENTRY_DATE_OF_BIRTH_ERROR', ' <span 
class="errorText">(eg. 05/21/1970)</span>');

 

I have searched the entire file and it doesn't seem to be there, this is all I could find in the area where I think it should be:

define('ENTRY_GENDER', 'Gender:');
define('ENTRY_GENDER_ERROR', ' <small><font color="#AABBDD">required</font></small>');
define('ENTRY_FIRST_NAME', 'First Name:');
define('ENTRY_LAST_NAME', 'Last Name:');
define('ENTRY_DATE_OF_BIRTH', 'Date of Birth:');
define('ENTRY_EMAIL_ADDRESS', 'E-Mail Address:');
define('ENTRY_COMPANY', 'Company name:');
define('ENTRY_STREET_ADDRESS', 'Street Address:');
define('ENTRY_SUBURB', 'Suburb:');

Sorry to be a pain but this is very frustrating, although I am very new to all of this and I must admit that frustrations excepted .... I am enjoying it :)

Link to comment
Share on other sites

Have you emptied your cache so as to make sure that you are not caching local files?

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

I cannot find one piece of code in admin/includes/languages/english.php

define('ENTRY_DATE_OF_BIRTH_ERROR', ' <span 
class="errorText">(eg. 05/21/1970)</span>');

I don't have this line either...are you actually experiencing a problem still? The admin language files only affect what you see (with the exception of a couple emails that you can send from admin to customers). They wouldn't affect your customers.

 

I'm confused as to what problem you are seeing now.

 

Hth,

Matt

Link to comment
Share on other sites

Thanks for posting Matt

At this stage I am probably far more confused than you about what I am seeing - but here goes!

 

When a customer sets up a new account - the prompt show the date in the format dd/mm/yyyy which is what I want, however he must actually input it as mm/dd/yyyy otherwise it initiates an error and returns him to the dob field to correct it.

 

HOWEVER - when the customer successfully sets up an account and then views account details his dob is shown in the desired dd/mm/yyyy similaraly I see it in this format when viewing through admin??

All I need to fix is the actual entry of the DOB by the customer (I think!!)

I'm quite sure it's very easy (when you know how)

 

Thanks again

 

David

Link to comment
Share on other sites

Around lines 30-6 of includes/languages/english.php, try changing

function tep_date_raw($date, $reverse = false) {
 if ($reverse) {
   return substr($date, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);
 } else {
   return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
 }
}

to

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);
 }
}

Hth,

Matt

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...