Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Wrong date format


PC Garant

Recommended Posts

Can someone help me with this issue...

I want to have the "date of birth" a required field when a new customer fills out the registration form.

I enable the function in the ADMIN section.

When I try out the new function, the help on the right side of the field says to write down the date in the DAY/MONTH/YEAR format. (Normal usage for Dutch customers...) This IS the right format for me.

But everytime I fill in this field, I get an error.

 

When trying out the 'wrong' format, month/day/year, it seemds to be working smoothly.

WHY???????

I looked up the file /catalog/includes/language/dutch.php and checked all the date formats. But still it doesn't work.

 

Anyone experience with this issue???

 

Thanks!

Link to comment
Share on other sites

The top of the includes/languages/dutch.php file should look like this:

 

// look in your $PATH_LOCALE/locale directory for available locales..
@setlocale(LC_TIME, 'nl_NL.ISO_8859-1');
@setlocale (LC_TIME, 'Dutch');

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, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);
 } else {
   return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
 }
}

 

From the error you are getting it looks as though someone has changed the text for Month-Day-Year to Day-Month-Year, but hasn't changed the formula.

 

Vger

Link to comment
Share on other sites

My file looks the same as you!

Except for the '@' markt in front of the first lines.

So I added them but it didn't make any differtent. :'(

 

I really would like to get this to work, because I could need this information when a customer place an order on credit. With the date-of-birth I can much more easy look up certain information about that particular customer.

Link to comment
Share on other sites

Sorry, the code I posted above was from a Dutch website, but they used the Month-Day-Year format. This is from a German website which uses the Day-Month-Year format:

 

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

}

}

 

Vger

Link to comment
Share on other sites

We're getting somewere!

I can fill the date in the right format, i.e. 24-12-2004 (24 december 2004) but the little help-text at the right still tells the customers to fill in in the 24/12/2004 format. (Note that the difference is is the '-' mark and the '/' mark.

 

I'll try to look it up in some files.

 

Also, when I create an account and go to the admin to change/view the details, I see the format in 12/24/2004...

Haven't looked at the customers side of it...

Link to comment
Share on other sites

define('ENTRY_DATE_OF_BIRTH_ERROR'

define('ENTRY_DATE_OF_BIRTH_TEXT'

 

both in includes/languages/dutch.php

 

You also have to edit admin/includes/languages/dutch.php to see the correct date format in the admin side of things.

 

Vger

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...