Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I format this date?


Floob

Recommended Posts

I have added the following line to my orders.php in admin

 

<td class="main"><?php echo tep_datetime_short($order->info['date_purchased']); ?></td>

 

This works fine, but is returning the date as MM/DD/YYYY

 

Can anyone show me how to change it to DD/MM/YYYY ?

 

Thanks for any pointers

 

Floob.

Link to comment
Share on other sites

Well I took a look - but I still dont get it.

 

I have changed it to:

tep_date_short

 

Which gets rid of the time - but how do I get MM/DD/YYYY ?

 

I think it is in the general.php in the admin section?

 

I think this is pretty simple - but I just dont get where I should change the format.

 

Anyone?

 

Thanks

 

Allen.

Link to comment
Share on other sites

  • 3 weeks later...

Can anyone help with this?

 

I'll say 'thanks' and everything... :)

 

I need to get

<?php echo tep_datetime_short($order->info['date_purchased']); ?>

 

to display as DD/MM/YYYY as opposed to MM/DD/YYYY

 

Thanks for any help

 

Floob.

Link to comment
Share on other sites

Look in english.php, or danish.php like this one, for:

 

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

 

A windows search can help you out most of the time.

Best Regards

olby

Link to comment
Share on other sites

Here is mine.

 

What should I change?

 

======

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

======

Link to comment
Share on other sites

Ah I swopped it for the english.php in my admin area and it works!!!

 

Thanks a lot.

 

It now looks like:

===============

 

// look in your $PATH_LOCALE/locale directory for available locales..

// on RedHat6.0 I used 'en_US'

// on FreeBSD 4.0 I use 'en_US.ISO_8859-1'

// this may not work under win32 environments..

setlocale(LC_TIME, 'en_US.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, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);

} else {

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

}

}

 

=============

 

Does that look correct to you?

Link to comment
Share on other sites

  • 3 years later...

Archived

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

×
×
  • Create New...