Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

date of birth


jeellison

Recommended Posts

Hi all,

 

Hope your all doing well.

 

A quick question which im sure is easy but I just cant seem to find it.

 

Where abouts to I change the format of date of birth from mm/dd/yyyy to dd/mm/yyyy for customers signing up?

 

Any help will be greatly appreciated.

 

Best Regards

J

Link to comment
Share on other sites

Here's how to do it. (remember to backup before any modification)

 

Also chage the country code to match yours (this example uses GB for UK)

 

********************************************************************

* Open catalog/includes/languages/english.php (this is for your catalog section)

* The changes are highlighted.

********************************************************************

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

 

////

// Return date in raw format

// $date should be in format mm/dd/yyyy

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

}

}

 

*********************

Also change the following

*********************

 

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

to

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. 05/21/1970)');

to

define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 21/05/1970)');

 

define('DOB_FORMAT_STRING', 'mm/dd/yyyy');

to

define('DOB_FORMAT_STRING', 'dd/mm/yyyy');

Link to comment
Share on other sites

  • 7 months later...
  • 4 months later...
  • 2 weeks later...
  • 6 months later...
  • 1 year later...
  • 4 months later...
I just tried your indications. I put :

@setlocale(LC_TIME, 'ro_RO.ISO_8859-2');

But the date is still in english format:

 

Monday 25 February .. instead of Luni, 25 Februarie.

 

What should i change?

 

Thank you,

 

Edmond

Something in one of the language files that you are using.

 

You should consider if you want dob to be collected. I can see no valid reason for it.

Link to comment
Share on other sites

  • 4 weeks later...
Something in one of the language files that you are using.

 

You should consider if you want dob to be collected. I can see no valid reason for it.

 

 

Some times it just doesn't work and this could be just an simple wrong configuration to server where your page is located.

Link to comment
Share on other sites

Hi,

 

Thanks for this great contribution.

I'm having a small problem on the 'Account_edit.php' file. I'm using the "Pulldown Date Of Birth V1.1 for EU date format (dd-mm-yyyy) stores".

I can not edit the date of birth; it only accepts 1-12 in the day’s field. When you select to "View or change my account information", and for example the date of birth was "23 June 1967" the date of birth is displayed as "1 June 1967" and when you try to change it to the correct DOB i.e. 23 June 1967 - the following error message is displayed "Your Date of Birth must be in this format: DD/MM/YYYY (eg 21/05/1970)".

 

I think the day field in the 'account_edit.php' is coded to accept months (1-12) instead of days (1-31). It works fine in the 'create_account.php' file.

 

Can some one please help?

 

 

Best wishes,

 

Paul

Link to comment
Share on other sites

  • 2 weeks later...
  • 5 months later...
  • 2 months later...

thank you very much :)

 

the "installation thread" on the sticky is not accurate. It didn't mention about changing this one...

 

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

}

 

thus i was having problem earlier... until i found out this thread :)

 

btw, i'm using the DOB, same as psg. now, it's working like a charm!

Link to comment
Share on other sites

  • 2 months later...
  • 5 months later...

THANKYOU SO MUCH......... I couldnt for the life of me get this right, I had changed everything but the numbers, thank you for highlighting the items needing to be changed, you got rid of my week long headache! :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...