Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to change date from month/day/year to 12/feb/2008


Ausgirl

Recommended Posts

Hello,

 

How would I change the date from reading month/day/year (12/30/2008) to actually read 12/feb/2008 as in Australia we read day/month/year (30/12/2008) but I want it to actually state the month like this: 12/feb/2008

 

Thanks

Link to comment
Share on other sites

Hello,

 

How would I change the date from reading month/day/year (12/30/2008) to actually read 12/feb/2008 as in Australia we read day/month/year (30/12/2008) but I want it to actually state the month like this: 12/feb/2008

 

Thanks

 

Hi Ausgirl

 

I think you need to edit languages/english.php, near the top. Taken from my PHP manual chm file.

 

M (Capital M) A short textual representation of a month, three letters Jan through Dec
m (lowercase m) Numeric representation of a month, with leading zeros 01 through 12
n Numeric representation of a month, without leading zeros 1 through 12 
d Day of the month, 2 digits with leading zeros 01 to 31 
D A textual representation of a day, three letters Mon through Sun 
j Day of the month without leading zeros 1 to 31 
l (lowercase 'L') A full textual representation of the day of the week Sunday through Saturday 
Y A full numeric representation of a year, 4 digits Examples: 1999 or 2003 
y A two digit representation of a year Examples: 99 or 03

 

HTH

 

Ian

Link to comment
Share on other sites

Modify date functions that are in general.php

 

 

Satish

 

Hi Satish,

 

Which parts do I need to change as you can see I changed this part but Ive either changed the wrong bits or not changed enough as at sign up it still telling me it must be in month/day/year.

 

// Output a raw date string in the selected locale date format
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
 function tep_date_long($raw_date) {
if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false;

$year = (int)substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);

return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$day,$month,$year));
 }

////
// Output a raw date string in the selected locale date format
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
// NOTE: Includes a workaround for dates before 01/01/1970 that fail on windows servers
 function tep_date_short($raw_date) {
if ( ($raw_date == '0000-00-00 00:00:00') || empty($raw_date) ) return false;

$year = substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);

if (@date('Y', mktime($hour, $minute, $second, $day, $month, $year)) == $year) {
  return date(DATE_FORMAT, mktime($hour, $minute, $second, $day, $month, $year));
} else {
  return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $day, $month, 2037)));
}
 }

Link to comment
Share on other sites

Hi Satish,

 

Which parts do I need to change as you can see I changed this part but Ive either changed the wrong bits or not changed enough as at sign up it still telling me it must be in month/day/year.

 

// Output a raw date string in the selected locale date format
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
 function tep_date_long($raw_date) {
if ( ($raw_date == '0000-00-00 00:00:00') || ($raw_date == '') ) return false;

$year = (int)substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);

return strftime(DATE_FORMAT_LONG, mktime($hour,$minute,$second,$day,$month,$year));
 }

////
// Output a raw date string in the selected locale date format
// $raw_date needs to be in this format: YYYY-MM-DD HH:MM:SS
// NOTE: Includes a workaround for dates before 01/01/1970 that fail on windows servers
 function tep_date_short($raw_date) {
if ( ($raw_date == '0000-00-00 00:00:00') || empty($raw_date) ) return false;

$year = substr($raw_date, 0, 4);
$month = (int)substr($raw_date, 5, 2);
$day = (int)substr($raw_date, 8, 2);
$hour = (int)substr($raw_date, 11, 2);
$minute = (int)substr($raw_date, 14, 2);
$second = (int)substr($raw_date, 17, 2);

if (@date('Y', mktime($hour, $minute, $second, $day, $month, $year)) == $year) {
  return date(DATE_FORMAT, mktime($hour, $minute, $second, $day, $month, $year));
} else {
  return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $day, $month, 2037)));
}
 }

Hi Ausgirl

 

It's most definately in /includes/languages/english.php This is mine, lines 19-24

 

@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('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S');

 

The default english.php is

 

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

 

Also, I've added and modded the price list contrib and in the language file I have

 

define('DATE_PRICE_LIST', 'jS F Y'); // date format (empty - none, M - month, jS - day of month, Y - year; see www.php.net/date)

 

So I get 8th February 2008

 

There's also a contrib to change your store to UK format here. I know you're in Aus but it looks like your date/time is the same as ours.

 

HTH

 

Ian

Link to comment
Share on other sites

Hi Ian,

 

Changing the english file does not work, it didnt even change the text on the page, something else needs to be changed. I know of the UK OSC its no good to me, because I dont know how to change the date/time or what files need to be changed. (I just want the date changed, nothing else). I dont have the price list contribution installed, so that codes no good to me either.

 

Your right our date /time is the same. Ive tried changing the english and the functions/general.php but its still the same. I get the

Your Date of Birth must be in this format: MM/DD/YYYY (eg 05/21/1970) error.

 

There has to be another file that needs changing somewhere, are you sure you only changed your english.php? Maybe there was another file you changed as well and youve forgotten? :huh:

Link to comment
Share on other sites

Hi Ian,

 

Changing the english file does not work, it didnt even change the text on the page, something else needs to be changed. I know of the UK OSC its no good to me, because I dont know how to change the date/time or what files need to be changed. (I just want the date changed, nothing else). I dont have the price list contribution installed, so that codes no good to me either.

 

Your right our date /time is the same. Ive tried changing the english and the functions/general.php but its still the same. I get the

Your Date of Birth must be in this format: MM/DD/YYYY (eg 05/21/1970) error.

 

There has to be another file that needs changing somewhere, are you sure you only changed your english.php? Maybe there was another file you changed as well and youve forgotten? :huh:

admin/includes/languages/english.php

*/

 

// 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_en_AU.ISO_8859-1'); // #Credits to Brian Sim (aka Simmy) http://www.oscommerce.com/forums/index.php?sho...p=520992#

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

}

}

 

// Global entries for the <html> tag

 

catalog/includes/languages/english.php

*/

 

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

// or type locale -a on the server.

// Examples:

// on RedHat try 'en_US'

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

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

@setlocale(LC_TIME, 'en_en_AU.ISO_8859-1'); // #Credits to Brian Sim (aka Simmy) http://www.oscommerce.com/forums/index.php?sho...p=520992#

 

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

}

}

 

// if USE_DEFAULT_LANGUAGE_CURRENCY is true, use the following currency, instead of the applications default currency (used when changing language)

 

I think that is all

Link to comment
Share on other sites

Hello Les,

 

I changed everything as you suggested and it now allows you to create an account using DOB 30/11/2008, but when I go into Admin and look at the customers details, the DOB goes back to 11/30/2008 and as a customer in my account "View or change account details" the DOB pops up as something completely different like 03/25/2010 :blink:

Link to comment
Share on other sites

  • 3 weeks later...

Hello everybody,

 

I already changed the date format in /includes/languages/english.php with "ro_RO.ISO8859-2"

In admin, same thing.

 

But the date language is still in english language.

I translated english pack in romanian language, every word, etc.

All it is ok, but the date is in english language.

This drive me crazy. Please an advice, i know it is posibble, because i saw on a site with oscommerce the date in romanian language.

 

the site is www.adifar.ro

 

/admin/includes/language/english.php

 

setlocale(LC_TIME, 'ro_RO.ISO8859-2');

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

 

 

/includes/language/english.php

 

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

// or type locale -a on the server.

// Examples:

// on RedHat try 'en_US'

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

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

@setlocale(LC_TIME, 'ro_RO.ISO8859-2');

 

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

 

WHAT IS WRONG?

 

 

Thank you very very much,

 

Edmond

Link to comment
Share on other sites

  • 2 weeks later...
Hello everybody,

 

I already changed the date format in /includes/languages/english.php with "ro_RO.ISO8859-2"

In admin, same thing.

 

But the date language is still in english language.

I translated english pack in romanian language, every word, etc.

All it is ok, but the date is in english language.

This drive me crazy. Please an advice, i know it is posibble, because i saw on a site with oscommerce the date in romanian language.

 

the site is www.adifar.ro

 

/admin/includes/language/english.php

 

setlocale(LC_TIME, 'ro_RO.ISO8859-2');

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

/includes/language/english.php

 

 

Edmond

 

I'm also having a similar problem.

Account Created: 02/24/2008

 

Last Modified: 02/26/2008

 

Last Logon: 03/05/2008

 

 

I've change date format in both admin/includes/languages/english.php and includes/languages/english.php

also includes/functions/general.php and admin/includes/functions/general.php

Should I also change the substrate values in the general.php files?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...