homewetbar Posted January 9, 2005 Posted January 9, 2005 Hello, I'm trying to change my date format on everything from the MM/DD/YY to the DD/MM/YY used here in America. I tried changing this in the english.php with no effect, how can I change this and not mess up my current data? Thanks! Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347
Simmy Posted January 9, 2005 Posted January 9, 2005 Change existing to the code below! (both catalog and admin!) @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'); //// // Return date in raw format // $date should be in format dd/mm/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); } }
Simmy Posted January 9, 2005 Posted January 9, 2005 obviously don't set locale to uk if you're not in the uk!
homewetbar Posted January 9, 2005 Author Posted January 9, 2005 I tried that but my orders are still displaying backwards when I display order history. MM/DD/YYYY instead of the DD/MM/YYYY I want them to. Any idea why this is? Also, by this change I'm not risking corupting any data am I? Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347
Simmy Posted January 9, 2005 Posted January 9, 2005 Make sure you changed this bit!!!! 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); } Works for me!
homewetbar Posted January 9, 2005 Author Posted January 9, 2005 Make sure you changed this bit!!!! 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); } Works for me! <{POST_SNAPBACK}> Nevermind, I've been up too long without sleep.... Most Valuable OsCommerce Contributions: Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294 FedEx Automated Labels -- Contribution 2244 RMA Returns system -- Contribution 1136 Sort Products By Dropdown -- Contribution 4312 Ultimate SEO URLs -- Contribution 2823 Credit Class & Gift Voucher -- Contribution 282 Cross-Sell -- Contribution 5347
firfin Posted January 10, 2005 Posted January 10, 2005 Nevermind, I've been up too long without sleep.... <{POST_SNAPBACK}> I hope you've recovered by now? Because i would like to know if that last comment helped you with your problem. I am experiencing something similar.checkdate en the database accept the new format after editing MY_LANGUAGE.php. However in the account_edit.php page there is a field for editing the DOB. The contents of this textfield are generating using function tep_date_short. This produces the date in the m/d/y format. How can I solve this? Thanks in advance. Can't think of a signature tight now. But just you wait till I read the next Discworld!
Guest Posted January 11, 2005 Posted January 11, 2005 Also change: define('ENTRY_DATE_OF_BIRTH_ERROR', 'Your Date of Birth must be in this format: MM/DD/YYYY (eg 05/21/1970)'); to define('ENTRY_DATE_OF_BIRTH_ERROR', 'Your Date of Birth must be in this format: DD/MM/YYYY (eg 21/05/1970)'); And define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 05/21/1970)'); to define('ENTRY_DATE_OF_BIRTH_TEXT', '* (eg. 21/05/1970)'); Good luck! :thumbsup:
Guest Posted January 11, 2005 Posted January 11, 2005 Whilst this works well for me, it throws up an unusuall error, in the backups the date now looks like this. dbshop-20041217194130.sql P19P_FriPMGMTE_GMT0DecE_December+0000RDecPMGMT 2,551,950 bytes And when i try to delete it, it wont let me for some weird reason :(
Guest Posted January 11, 2005 Posted January 11, 2005 Whilst this works well for me, it throws up an unusuall error, in the backups the date now looks like this.And when i try to delete it, it wont let me for some weird reason :( <{POST_SNAPBACK}> Hi Paul, where did you see this error? Is it in the Admin|Tools|Database backup?
Guest Posted January 11, 2005 Posted January 11, 2005 Note that Date Format section in Admin's english.php and Catalog's english.php are a little different. This is for Admin's 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_UK.ISO_8859-1'); // this is used for strftime() 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); } } And Catalog's 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_UK.ISO_8859-1'); // this is used for strftime() 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); } }
Guest Posted January 14, 2005 Posted January 14, 2005 Sorry didnt realise you had responded :( Damn forums. Yes its in the backup table, the line I posted above is one of 5 backups I always in place. Weird huh. I will check the difference between admin/catalog thnx
Guest Posted January 15, 2005 Posted January 15, 2005 Sorry didnt realise you had responded :( Damn forums. Yes its in the backup table, the line I posted above is one of 5 backups I always in place. Weird huh. I will check the difference between admin/catalog thnx <{POST_SNAPBACK}> Also see the step-by-step solution here http://www.oscommerce.com/forums/index.php?showtopic=130454&hl=
Recommended Posts
Archived
This topic is now archived and is closed to further replies.