Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change Date Formats?


CaptainBlue

Recommended Posts

Posted

Is there a global way to change the date format from mm/dd/yyyy to the UK's dd/mm/yyyy format?

 

I'm thinking of the birth date entry area as well as other areas where dates are shown/used/echoed.

 

Thanks in advance.

Posted
Is there a global way to change the date format from mm/dd/yyyy to the UK's dd/mm/yyyy format?

 

I'm thinking of the birth date entry area as well as other areas where dates are shown/used/echoed.

 

Thanks in advance.

 

 

catalog/includes/languages/english.php

 

right at the top

 

hope it helps

 

B

Posted

Look at the top section of includes/languages/german.php or spanish.php - because they both use the dd/mm/yyyy format. Do the same for admin/includes/languages/

 

Vger

Posted
Look at the top section of includes/languages/german.php or spanish.php - because they both use the dd/mm/yyyy format. Do the same for admin/includes/languages/

 

Vger

 

This only changes the output of dates from what I can tell. To change the account creation form to accept dd/mm/yyyy dates, you must also make changes to create_account.php.

 

 

Michael

Posted
This only changes the output of dates from what I can tell. To change the account creation form to accept dd/mm/yyyy dates, you must also make changes to create_account.php.

 

Wrong. You make the changes I recommended in includes/languages/english.php and admin/includes/languages/english.php and further down those same pages are the text defines which put the text on the Create Account page e.g. 05/21/1970 - but it's only text, so the text definition just needs to be changed to e.g. 21/05/1970

 

Vger

Posted
Wrong. You make the changes I recommended in includes/languages/english.php and admin/includes/languages/english.php and further down those same pages are the text defines which put the text on the Create Account page e.g. 05/21/1970 - but it's only text, so the text definition just needs to be changed to e.g. 21/05/1970

 

 

 

Vger

 

 

 

Forgive me, I've only been using osCommerce since yesterday. It seemed to me after making those changes (and I spotted the 05/21/1970 thing you mentioned) it still rejected my dd/mm/yyyy dates. The easiest solution was to set osCommerce not to ask for these details.

 

In my opinion, starting a post with "Wrong" isn't very friendly.

 

 

Michael

  • 1 month later...
Posted

Hi, i have opened the site and started trading already, if i change the files now will it affect my other customers who have signed up using the original mm/dd/yyyy format??

 

thanks

Posted

Well I've just made the changes suggested by Vger and any new accounts are accepted just fine, thanks. Also, all the old accounts had the day and month switched around to the correct format.

Posted
In my opinion, starting a post with "Wrong" isn't very friendly.

 

Sorry if that upset you - but it upsets me when someone with under 10 posts tries to say that someone with over 13,000 posts is wrong. It comes under the heading of the old saying "teaching Grandma how to suck eggs".

 

Vger

Posted

First time into osCommerce, thank god for the forum otherwise i would be long gone!

 

Have read the posts above and carried out changes to admin/includes/languages/english.php and includes/languages/english.php, comparing them against teh spanish and german verions but when i try and create a new account an error states that the date format is wrong (even though i have changed the error text!).

 

If i put the DOB in the american format the account creates however the customer details in admin displays the DOB in english format! It just seems to be the validation of the date that is causing the problem but i am only guessing

 

What have i missed?

Cheers

  • 1 month later...
Posted
... If i put the DOB in the american format the account creates however the customer details in admin displays the DOB in english format! It just seems to be the validation of the date that is causing the problem but i am only guessing...

 

Hi

Having followed the above advice, I now have the same problem. ie...

 

When the date input in dd/mm/YYYY format is parsed, it rejects it. But when input in mm/dd/YYYY the date is accepted, but displayed in dd/mm/YYYY format in the account details page.

 

Does anyone know how to correct this to save me (and others) trawling through lines of unfamiar code?

Regards

D

Posted
...Having followed the above advice, I now have the same problem. ie...

One thing that people may overlook is the tep_date_raw function in the english.php. Make sure (and compare it carefully) you change it to read:

 

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

 

You can find that function at about line 30. W/o saying you also need to make the other changes in the same file but it seems that tep_date_raw function bit is most likely to miss. Otherwise I cant think of any other reason.

 

Ken

commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile).

over 20 years of computer programming experience.

Posted
...One thing that people may overlook is the tep_date_raw function in the english.php....
<_< Yes I'd already found that code and amended it accurately enough in line with your suggestion.
...W/o saying you also need to make the other changes in the same file...
:huh: Errr what's that? other changes? same file?... ooops

 

Thanks Ken. I'd changed the english.php in the includes folder, but forgot to amend the one in my DWT template folder... Just working too late I guess...

 

Works fine now... thanks so much... and regards

David

Archived

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

×
×
  • Create New...