Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Date format British needed


j_chakraverty

Recommended Posts

Posted

Got up and running a new installation of OSCOMMARCE

I realised I could cahnge currecny, language, flag etc. but the entire site works on US date format mm/dd/yyyy

My country strictly adherces to the british date format dd/mm/yyyy

How can I impliment that change in my installation.

This feature is absolute esential and so much so that I shall be forrced to rewrite a new software just because this feature can be implimented. I hope there is a quick solution somewhere

Posted

1. open catalog/includes/languages/english.php

2. find

@setlocale(LC_TIME, 'en_US.ISO_8859-1');

define('DATE_FORMAT_SHORT', '%m/%d/%Y');  // this is used for strftime()
define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime()
define('DATE_FORMAT', 'm/d/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, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);
 } else {
   return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
 }
}

 

and change it like this:

@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 dd/mm/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);
 }
}

 

and then find this :

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

and change it to

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

 

then look for this:

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

and change it to this:

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

 

i have done it and it works fine.

Did you try? Did you fail? No matter! Try again. Fail again! But fail better!

  • 4 weeks later...
Posted

I have a similar problem with french date. I checked the content of french.php but @setlocale(LC_TIME, 'fr_FR.ISO_8859-1'); is correct.

 

But I always the name of days and months appear in english on screen instead of french?

 

Could you help me?

Thanks

  • 3 weeks later...
Posted

i think lama69 is talking about the counter date at the right bottom rather than date in sign up/create account! he might be refering to the day and months showing in english rather than french!

Did you try? Did you fail? No matter! Try again. Fail again! But fail better!

Posted

th esetlocale for french as you say is correct!

 

try this see what happens!

 

@setlocale (LC_TIME, "fr_FR");

 

alternatively something like the following may work:

 

$locale = 'fr_FR.ISO8859-1';
do {
 $locale_result = setlocale(LC_TIME, $locale);
} while ($locale_result != $locale);

 

or something like that! i'm not a programmer so please BACK UP and double check this.

 

hope it helps.

Did you try? Did you fail? No matter! Try again. Fail again! But fail better!

  • 4 months later...
Posted

In your osCommerce control panel, under Configuration --> Customer Details, why don't you just turn Date Of Birth from 'true' to 'false' ? And while you're there do the same for 'Business' and 'Suburb'

 

Vger

Archived

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

×
×
  • Create New...