Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Date of Birth DOB problem


woekiewoekie

Recommended Posts

Posted

A problem with a simple solution, I think, except I don't know where to look.

 

I have mm/dd/yyyy but I want dd/mm/yyyy. Could someone please help me solve this? I can't find anything about it in WiKi documentation. Or I didn't look that good :?

Posted

Hi there in catalog/includes/languages/application_top.php find the following code

 

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 to........

 

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

 }

}

 

 

You will need to do the same in the admin/includes/languages/english.php

 

And ofcourse in any other language files you may support if necessary

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Posted

It isn't the application_top.php file in catalog/includes/languages that needs to be altered, but the english.php file. The same filename as in the admin section, that is.

Posted

you're right its english.php in both admin and catalog!!!

 

my bad

Reddy to Rumble

 

Thank you osCommerce and all who Contribute to her!

Posted

That works but how can I change the example that oscommerce uses '(eg. 05/21/1970)'. I obviously want to change it to (eg. 21/25/1970) style example.

 

Thanks

-Alex

  • 3 weeks later...
Posted
........ change to........  

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

 }

}

 

 

You will need to do the same in the admin/includes/languages/english.php

 

In the admin includes file there is an additional statement:

define('PHP_DATE_TIME_FORMAT', 'm/d/Y H:i:s'); // this is used for date()

I'm assuming that this needs changing as well but I'm wondering why there needs to be this additional statement which isn't in the catalog includes file?

A clarification would be appreciated.

Archived

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

×
×
  • Create New...