Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

date format in create_account.php


stefaantje

Recommended Posts

The shop is for Belgium.

 

In Belgium, our date format is dd/mm/yyyy

 

By default, the form in create_account.php uses mm/dd/yyyy

 

How do I change this that the user can input this like he's used to but in such a way the date is still correctly formatted in the database.

 

I've searched Google and the forums, found lots of results, nothing usable.

Link to comment
Share on other sites

In my includes/languages/english.php, I have

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

I would think that in includes/languages/dutch.php (and possibly your english.php, if you have British customers), it should be

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

like it is in includes/languages/german.php. If not, that's the place to edit it. %d is day of month; %m is numeric month; %Y is four digit year; %A is day of week (Monday, Tuesday, etc.); %B is the name of the month (January, etc.).

Always back up before making changes.

Link to comment
Share on other sites

UK-Based osCommerce 2.2 http://addons.oscommerce.com/info/2816

& Date of Birth PullDown http://addons.oscommerce.com/info/3778

 

It annoys me that the default is the us style, when most countries use the european standard

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

thanks, but that solution doesn't look very reliable

the solution itself has several bug fixes

 

this is one of the main problems of oscommerce

why is it that for a simple problem, each time you've to edit at least 4 php files or more

 

get all that kind of information into one config.php and solved

and stay with one language file per language file and solved

and widgetize your modules, boxes

and most of all, get your template engine right like Wordpress does

 

now I've to spend hours and hours to fix bugs I didn't create myself

instead of spending hours on a good design and concept

 

UK-Based osCommerce 2.2 http://addons.oscommerce.com/info/2816

& Date of Birth PullDown http://addons.oscommerce.com/info/3778

 

It annoys me that the default is the us style, when most countries use the european standard

Link to comment
Share on other sites

But at least someone spent many hours producing the contrib(s) in the first place so you don`t have to do much really, and your not being charged a single penny.

 

So your complaing its not laid out on a plate for you to do in 5 mins flat!!

 

And how much have you given back?? <_<

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

I can't give anything back if it doesn't work properly in the first place.

 

occommerce needs to get its act together first

 

if I say in dutch.php to use the dutch date format dd/mm/yyyy

 

I expect that to work or is that asking too much?

 

I don't think so.

Link to comment
Share on other sites

Would you be so nice to tell us what lines of code?

 

yes of course

 

see also http://forums.oscommerce.nl/index.php?showtopic=22336

 

Dutch.php is the file to edit

 

CODE

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

 

CODE

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

}

}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...