Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Date Format


HaloHunter

Recommended Posts

Hi,

 

I'm looking for a way to change the default date format to DD/MM/YYYY. I've looked everywhere, I cant find it.

 

Also, how do I get rid of the "New Products in January" box?

 

Thanks for the help!

 

The date format is found in your english.php file

 

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

}

}

 

 

To remove the new products box find the following in your index.php file and delete or comment out

 

<tr>

<td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

</tr>

The Knowledge Base is a wonderful thing.

Do you have a problem? Have you checked out Common Problems?

There are many very useful osC Contributions

Are you having trouble with a installed contribution? Have you checked out the support thread found Here

BACKUP BACKUP BACKUP!!! You did backup, right??

Link to comment
Share on other sites

Thanks for the reply. However in the registration screen, next to date of birth I see this:  (eg. 05/21/1970)

 

How do I get rid of or change this?

 

includes/languages/english.php

 

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

The Knowledge Base is a wonderful thing.

Do you have a problem? Have you checked out Common Problems?

There are many very useful osC Contributions

Are you having trouble with a installed contribution? Have you checked out the support thread found Here

BACKUP BACKUP BACKUP!!! You did backup, right??

Link to comment
Share on other sites

define('DATE_FORMAT_SHORT', '%m/%d/%Y');  // this is used for strftime()

... else {

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

  }

}

Thanks a lot you really helped me out with this one, I hope it also did the trick for halohunter. Seems to work perfect now, the dates get accepted and entered into the database. I only have one problem. on the account_edit.page the date is displayed in a texbox, but there it is in the old mdy format.

 

The function reponsible for displaying the date seems to be tep_date_short.

Must /can I edit this function somewhere ? Or have I overlooked something?

Can't think of a signature tight now. But just you wait till I read the next Discworld!

Link to comment
Share on other sites

Thanks a lot you really helped me out with this one, I hope it also did the trick for halohunter.  Seems to work perfect now, the dates get accepted and entered into the database. I only have one problem. on the account_edit.page the date is displayed in a texbox, but there it is in the old mdy format.

 

The function reponsible for displaying the date seems to be tep_date_short.

Must /can I edit this function somewhere ? Or have I overlooked something?

 

 

what lines do i have to change? sorry for the dumb question.

Link to comment
Share on other sites

////

// 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 the above section need to be changed? I'm very new to PHP and I would like to know what the substr() part does and what it needs to be changed to...

 

Thanks

Link to comment
Share on other sites

I have a question regarding this:

 

I want the shop to be in Norwegian, but since it comes with the english languange-pack installed as default, the date and time will still be in english format. So how can I make ie. "Januar" be displayed instead of "January"?

 

Regards,

Espen

Link to comment
Share on other sites

The date format is found in your english.php file

 

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

  }

}

To remove the new products box find the following in your index.php file and delete or comment out

 

<tr>

            <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td>

          </tr>

 

Hi

I see how to get to the new products box .. but is it possible for me to move it down the page a little??

Link to comment
Share on other sites

Does the above section need to be changed? I'm very new to PHP and I would like to know what the substr() part does and what it needs to be changed to...

 

Thanks

I swapped the 3's and the 0's in your quote. so the 0 ->3 and the 3-> 0. It is where ozcsys said. in your language.php. Substr($string , $first , $second) get a substring from $string starting at the $first character for a length of $second.

Can't think of a signature tight now. But just you wait till I read the next Discworld!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...