Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing the date format.


Guest

Recommended Posts

Hello,

 

I'm trying to change the date and order was placed from the American mm/dd/yy to the English dd/mm/yy.

 

I have changed the english.php file in includes/languages/ but this hasn't worked.

 

On the invoice and packing slip the following code is being used to call the purchase date:

 

php echo tep_date_short($order->info['date_purchased']);

 

Hope you can help.

 

Thanks in advance

-turner2000

Link to comment
Share on other sites

Here is what I use.

 

********************************************************************

* Open catalog/includes/languages/english.php (this is for your catalog section)

* The changes are highlighted.

********************************************************************

@setlocale(LC_TIME, 'en_GB.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 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);

}

}

 

*********************

Also change the following

*********************

 

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

to

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. 05/21/1970)');

to

define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 21/05/1970)');

 

define('DOB_FORMAT_STRING', 'mm/dd/yyyy');

to

define('DOB_FORMAT_STRING', 'dd/mm/yyyy');

Link to comment
Share on other sites

Hey,

 

Thanks for the quick reply - I have made the above changes but it hasn't worked. In admin it still shows the date as mm/dd/yy and the same for invoice and packing slip.

 

It works ok if I just need to input todays date but I am calling the order date which is still showing as mm/dd/yy.

 

-turner2000

Link to comment
Share on other sites

As stated above, that modification was for your catalog section.

 

To change to format in the admin section, you'll have to edit the admin's files.

 

********************************************************************

* Open catalog/admin/includes/languages/english.php (this is for your admin section)

* The changes are highlighted.

********************************************************************

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('PHP_DATE_TIME_FORMAT', 'd/m/Y H:i:s'); // 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, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4);

} else {

return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2);

}

}

 

*********************

Also change the following

*********************

 

define('DOB_FORMAT_STRING', 'mm/dd/yyyy');

to

define('DOB_FORMAT_STRING', 'dd/mm/yyyy');

Link to comment
Share on other sites

Thanks - that's sorted it. I'm still trying to get my head around OSCommerce. Everything seems to be in so many places but anyway thanks again for your help!

Link to comment
Share on other sites

Correction.

 

UK does not exist in the unix-based-OS time definition: Use GB or GMT instead.

 

Change

setlocale(LC_TIME, 'en_UK.ISO_8859-1');

to

setlocale(LC_TIME, 'en_GB.ISO_8859-1');

or

setlocale(LC_TIME, 'en_GMT.ISO_8859-1');

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

Hi

 

Does anyone know what the Australian time code is for unix? Ie GB = England

 

Does AU = Australia and is this all necessary?

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
Correction.

 

UK does not exist in the unix-based-OS time definition:  Use GB or GMT instead.

 

Change

setlocale(LC_TIME, 'en_UK.ISO_8859-1');

to

setlocale(LC_TIME, 'en_GB.ISO_8859-1');

or

setlocale(LC_TIME, 'en_GMT.ISO_8859-1');

 

 

Where can I find other "unix-based-OS time definition"? I need to change it to GMT+1 and with danish has langues, as I get english days on my invoices, eg. monday and wednesday

Link to comment
Share on other sites

  • 3 weeks later...

I have tried in admin/includes/languages/english.php

 

setlocale(LC_TIME, 'en_GMT.ISO_8859-1');

setlocale(LC_TIME, 'en_GB.ISO_8859-1');

setlocale(LC_TIME, 'en_UK.ISO_8859-1');

 

And my time in Admin is still showing 7 hours behind where my server is located :(

 

Any ideas why this is?

Link to comment
Share on other sites

I have tried in admin/includes/languages/english.php

 

setlocale(LC_TIME, 'en_GMT.ISO_8859-1');

setlocale(LC_TIME, 'en_GB.ISO_8859-1');

setlocale(LC_TIME, 'en_UK.ISO_8859-1');

 

And my time in Admin is still showing 7 hours behind where my server is located

 

Any ideas why this is?

 

Is your server running on MS Windows OS?

If so, then you can try:

@setlocale(LC_TIME, 'English');

Link to comment
Share on other sites

  • 4 years later...

Archived

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

×
×
  • Create New...