Mavin Posted October 11, 2002 Posted October 11, 2002 I have some problems with the date format on the site. In US and many countries they specify the date in the format mm/dd/yyyy but in sweden we use yyyy-dd-mm nad i have tried almost anythnig but i can?t get it to work with that format or as mather a fact i can?t define it to work that way. Anyone who knows what to change to get i to work in that format.
Jan0815 Posted October 11, 2002 Posted October 11, 2002 In the languages file there are routines that handle date format. In english.php under catalog/includes/languages you will find this: 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'); I guess you can figure out what to change here in your swedish.php. If not, please tell us and we will try to help. You can't have everything. That's why trains have difficulty crossing oceans, and hippos did not adapt to fly. -- from the OpenBSD mailinglist.
Mavin Posted October 11, 2002 Author Posted October 11, 2002 This is how i have configured in my swedish.php setlocale(LC_TIME, 'sv_SE.ISO_8859-1'); define('DATE_FORMAT_SHORT', '%Y-%m-%d'); define('DATE_FORMAT_LONG', '%A %d %B, %Y'); define('DATE_FORMAT', 'Y-m-d'); // this is used for date() define('DATE_TIME_FORMAT', DATE_FORMAT_SHORT . ' %H:%M:%S'); But it won?t work when i try to edit my account for example
janfcg Posted October 11, 2002 Posted October 11, 2002 This is how I've done it for dutch (also dd/mm/yyyy). But this also doesn't work. If I make a new account, I need to enter it starting with month, and that's not what I want. Please help! 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');
Mavin Posted October 11, 2002 Author Posted October 11, 2002 It got to be somewhere else we have to set it up too!
Jan0815 Posted October 11, 2002 Posted October 11, 2002 Try with the german laguage. It works. Take the german.php as a starting point. Oops. I just noticed the problem. You must also adjust the tep_date_raw function in the language file. Again - use the german.php as an example. At least for the dutch format it will work. HTH You can't have everything. That's why trains have difficulty crossing oceans, and hippos did not adapt to fly. -- from the OpenBSD mailinglist.
Mavin Posted October 11, 2002 Author Posted October 11, 2002 Please can?t you just help me with this tep_date_raw i don?t understand anything of it! i won?t it in swedish format yyyy-mm-dd
janfcg Posted October 11, 2002 Posted October 11, 2002 Thanks, now it works! It was indeed the tep_date_raw function.
Mark Evans Posted October 11, 2002 Posted October 11, 2002 Please can?t you just help me with this tep_date_raw i don?t understand anything of it! i won?t it in swedish format yyyy-mm-dd Why noy do it the easy way!!! http://telia.dl.sourceforge.net/sourceforg...sh-pr2.1.tar.gz That is the swedish language pack for 2.1 look at the date formats in the svenska.php file :) Mark Evans osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops) --------------------------------------- Software is like sex: It's better when it's free. (Linus Torvalds)
Jan0815 Posted October 11, 2002 Posted October 11, 2002 Please can?t you just help me with this tep_date_raw i don?t understand anything of it! i won?t it in swedish format yyyy-mm-dd Try: function tep_date_raw($date, $reverse = false) { if ($reverse) { return substr($date, 6, 4) . substr($date, 3, 2) . substr($date, 0, 2); } else { return substr($date, 0, 2) . substr($date, 3, 2) . substr($date, 6, 4); } } Not tested, not even well-thought, just the first try as I am running out of time to catch the train. You can't have everything. That's why trains have difficulty crossing oceans, and hippos did not adapt to fly. -- from the OpenBSD mailinglist.
Mavin Posted October 23, 2002 Author Posted October 23, 2002 that didn?t work either s? wath is it with this system, i?m getting realy tired... :? Please help!
Guest Posted November 4, 2002 Posted November 4, 2002 any solution to this yet? noticed that there seems to be something hardcoded in create_account_process.php in the catalog root. if (checkdate(substr(tep_date_raw($dob), 4, 2), substr(tep_date_raw($dob), 6, 2), substr(tep_date_raw($dob), 0, 4))) { not sure what it is though. One thing that is certain though is that it does not matter what you enter in the swedish.php, the create account process always seems to want the english date. Same goes for the advanced search function which also freaks out.
rhedlund Posted November 15, 2002 Posted November 15, 2002 Try changing the substr parameters in the function tep_date_raw in the file includes/languages/svenska.php. This worked for me: :) function tep_date_raw($date, $reverse = false) { if ($reverse) { return substr($date, 8, 2) . substr($date, 5, 2) . substr($date, 0, 4); } else { return substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2); } }
mrMagoo Posted January 27, 2003 Posted January 27, 2003 Got it to work now. Second is to get the last four didgits in. Has anyone got that to work? Fred
mrMagoo Posted January 27, 2003 Posted January 27, 2003 Thought I could post my answer for it:) setlocale('LC_TIME', 'sv_SE.ISO_8859-1'); define('DATE_FORMAT_SHORT', '%Y-%m-%d'); // this is used for strftime() define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime() define('DATE_FORMAT', 'Y-m-d'); // 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, 8, 2) . substr($date, 5, 2) . substr($date, 0, 4); } else { return substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2); } } This changes made in swedish.php /Fred :D
Beridox Posted May 1, 2003 Posted May 1, 2003 Thanks Fred! One question, does it show the right date on the footer bar 1731 sidvisningar sedan Tuesday 22 April, 2003 ? I cant seem to get that bit to work :( /Anneli
Beridox Posted May 1, 2003 Posted May 1, 2003 Me again! @setlocale('LC_TIME', 'swedish'); define('DATE_FORMAT_SHORT', '%Y-%m-%d'); // this is used for strftime() define('DATE_FORMAT_LONG', '%A %d %B, %Y'); // this is used for strftime() define('DATE_FORMAT', 'Y-m-d'); // 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, 8, 2) . substr($date, 5, 2) . substr($date, 0, 4); } else { return substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2); } } This made it in my svenska.php file. :D :D /Anneli
Recommended Posts
Archived
This topic is now archived and is closed to further replies.