Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

UK date of birth format


Guest

Recommended Posts

Posted

I have changed the date formula to what I think should be the UK date format (dd/mm/yy) in every english.php I can find in my shop. It accepts the date entered when you make an account, but then when you look at the account details for the account instead of displaying 20/06/1972, it displays 06/06/1972, and even if you edit the date in the account it still reverts back to 06/06/1972.

The formula I am using for the date is this.

 

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

}

}

 

Is this right, I got it from an earlier post with someone who had the same problem.

 

Thanks

G

Posted

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

 

////

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

}

}

 

Then don't forget that you also have admin/includes/languages/english.php as well

 

Vger

Posted

Thanks for the speedy reply,

But I have changed that one as well.

I have changed it in the catalogue/includes/languages as well, is that wrong?

Thanks

G

Posted

Are you getting confused between the code which defines how the date format has to be entered by the customer with the text which appears next to it - telling them how they should enter it.

 

The text which tells them how they should enter the d.o.b. is also found in catalog/includes/languages/english.php but lower on down the page.

 

Vger

Posted

I am confused about what section does what, because I see english.php in three places, in the catalogue, in admin and in root/includes/languages, whats the difference?

I still dont know why it accepts the date entered, but then changes it so that the day entered becomes the month, and the month stays the same, is it that there is a wrong formula somewhere, but I cant find it?

Sorry for my confusion.

G

Posted

If you didn't use this part in place of the default one, then that's what would happen:

 

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

}

}

 

I don't know what you mean by the 'catalogue'. If you installed in the root of your web - so that your osC site is available at http://www.yourdomain.com - then there shouldn't be a 'catalog' folder. If you installed in the catalog folder (so that your osC site is available at http://www.yourdomain.com/catalog) then the english.php files are as follows:

catalog/includes/languages/english.php

catalog/admin/includes/languages/english.php

 

Provided you make the changes as outlined it should work fine.

 

Vger

Archived

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

×
×
  • Create New...