Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change date format


msbsindia

Recommended Posts

Just installed oscommerce successfully.

Waiting to go live.

When any user tries to register on the site - it shows birth date box in following format - m/d/y

I hope this will be the same in any others section of oscommerce.

How can I change this to d/m/y.

Link to comment
Share on other sites

Just installed oscommerce successfully.

Waiting to go live.

When any user tries to register on the site - it shows birth date box in following format - m/d/y

I hope this will be the same in any others section of oscommerce.

How can I change this to d/m/y.

 

Change this in includes/languages/english.php

 

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 this (you can copy it from german.php, also)

 

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

BACKUP your current files before editing. Did I mention to BACKUP your current files, first?

 

"I'm not a hero, I'm a firefighter; it is my job to save lives. I'm a Jesus Christ Firefighter saving souls from the flames!"

 

Installed contribs: Almost XP Buttons *** Attribute Sort *** Auto Thumbnail Change *** Column Product Listing (for SPPC v4.0) *** Contact Us Registered *** Country-State Selector 1.3.3J *** CC# Db Mask 1.3 *** Email Order Clickable Link *** Extra Images *** Linkpoint API CVM *** Loginbox Best *** New Spiders *** New Attrib Mgr v.5.0 w/ New Attrib Include *** Multi Product Update *** MySQL Cron *** Pricing per Category *** Product Listing in Columns v2.2 [later upgraded to CPL(SPPC)] *** Product Sort v1.6 *** Seperate Pricing Per Customer v4.15 *** Simple Down for Maintenance [Gokou] *** Ultimate_SEO_URLs_v2.2.2 *** UPS Worldship Export 1.3 *** Welcome Email username & password

Link to comment
Share on other sites

Now - there is one problem.

In the footer - It shows date as - Sunday, 13. August 2006.

Instead I want to show Sunday, 13 August 2006.

i.e. I want to remove the dot.

How Can I Do So?

 

 

 

 

 

 

 

Change this in includes/languages/english.php

 

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 this (you can copy it from german.php, also)

 

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

Link to comment
Share on other sites

Look in your includes/footer.php file around line 29 or 30. Looks like your code might be messed up a little bit with one too many periods. If you want to post your footer.php file I can look at it for you if you don't know what to do. Also, provide a link to your website.

Link to comment
Share on other sites

I got it.

I modified the code to the following-

 

 

 

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

 

 

But I am not able to understand what does that "substr" mean?

Link to comment
Share on other sites

Straight from the PHP manual.

 

substr

(PHP 3, PHP 4, PHP 5)

 

substr -- Return part of a string

Description

string substr ( string string, int start [, int length] )

 

 

substr() returns the portion of string specified by the start and length parameters.

 

If start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth.

 

 

Clear as mud. :thumbsup:

Link to comment
Share on other sites

Straight from the PHP manual.

 

substr

(PHP 3, PHP 4, PHP 5)

 

substr -- Return part of a string

Description

string substr ( string string, int start [, int length] )

substr() returns the portion of string specified by the start and length parameters.

 

If start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth.

Clear as mud. :thumbsup:

 

 

 

I don't know what is the use of substr here - but I hope that there are no errors in the use of substr in the code modified.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...