Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

date format


webchi

Recommended Posts

Did you write a Turkish translation?

 

Then look at file languages/turkish.php

 

At the top you will find lines looking like this:

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

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

 

Change to whatever format you want. Especially pay attention to the "locale" setting. Ask your ISP what is available.

Christian Lescuyer

Link to comment
Share on other sites

  • 3 weeks later...

i translated a turkish language file

and i changed this code like this

 

---------------------------------------------------------------------------

setlocale(LC_TIME, 'tr.iso-8859-9');

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

 

------------------------------------------------------------------------------

but i could not change english day and month name.

for example friday,january ....

 

what can i change this day,month...

Link to comment
Share on other sites

:oha: Oh, I know that problem and a way to solve it is this:

 

in your language file (e.g. turkish.php AND all the others) at the top set this:

//----------------Start of local time/date format-------------------------------

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

// on RedHat try 'en_US'

// on FreeBSD try 'en_US.ISO_8859-1'

// on Windows try 'en', or 'English'

setlocale(LC_TIME, 'da_DK.ISO_8859-1'); //This have to be changed for your locale settings. Ask your hostmaster!!

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

}

}

 

 

//----------------End of local time/date format----------------------

in same file change these defines to something like:

 

 

// Global entries for the <html> tag

define('HTML_PARAMS','dir="LTR" lang="da"');

 

// charset for web pages and emails

define('CHARSET', 'iso-8859-1');

 

// text for date of birth example

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

 

define('ENTRY_DATE_OF_BIRTH_ERROR', ' <small><font color="#FF0000">(eg. 21/05/1965)</font></small>');

 

define('ENTRY_DATE_OF_BIRTH_TEXT', ' <small>(eg. 21/05/1965) <font color="#AABBDD">needed</font></small>');

 

define('JS_DOB', '* The 'Date of Birth' entry must be in the format: xx/xx/xxxx (day/month/year).n');

 

 

 

In the file /catatlog/create_account_process.php AND /catalog/account_edit_process.php change the Day of Birth (DOB) format to this:

 

//-------------Start of DOB format--------------------------------------

if (ACCOUNT_DOB == 'true') {

if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4))) {

$entry_date_of_birth_error = false;

} else {

$error = true;

$entry_date_of_birth_error = true;

}

}

 

//-----------------End of DOb format---------------------------------

 

 

 

 

This should give you the date of birth format like 21/02/1965 and a time like 21:53 writing long weekday in your language. After this you have to make the same settings in the admin parts also. They are equal apart from this in the top of the languagefile:

 

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

 

It works on my server, but please let me know if you still have troubles with this.

 

good luck :)

:-Jes

Link to comment
Share on other sites

i could not understand!

only i want to change name of days, name of months like that

from monday to pazartesi ( in the turkish )

from januar to ocak (in the turkish)

 

all date format is on my site like this:

This product was added on Friday 21, 2003

 

 

i hope , i could tell!

 

i am sorry :(

Link to comment
Share on other sites

The only line you should change is this:

 

setlocale(LC_TIME, 'da_DK.ISO_8859-1'); //This have to be changed for your locale settings.

 

Find out what operating system your server are using, and change it according to this.

 

:-)

 

 

/jes saxe

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...