If this is your first visit, check our documentation. To post, register or login.

date in swedish

Locked

Started by typhoon on 25 Jul 2006, 11:52 AM · Views: 3,113

Results 1 to 14 of 14
This thread is locked. New replies are disabled.
25 Jul 2006, 11:52 AM
#1
typhoon avatar

typhoon

Zen Follower

Join Date:
Jul 2006
Posts:
144
Plugin Contributions:
0

date in swedish

Hi !

I am using ZC 1.3.0.2 with the swedish language pack on xp.

  1. If a customer is entering a birth date like 1971-05-05 it will be saved like 2037-05-05. How to make this show correct ?

  2. I read that there is a dropdown menu for the dates but it seems not to be available anywhere. Maybe this would be a solution ?

/Typhoon

7 Aug 2006, 9:49 PM
#2
beez avatar

beez

Zen Follower

Join Date:
Sep 2005
Location:
Malmö, Sweden
Posts:
117
Plugin Contributions:
4

Re: date in swedish

Hi, Me and vike has mad it work... It is changes in two files, /includes/modules/create_account.php and /includes/languages/swedish.php

In create_account.php on line 129 change '/' to '-'

In Swedish.php on line 35 change
return substr($date, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);
to
return substr($date, 8, 2) . substr($date, 5, 2) . substr($date, 0, 4);

and change line 35
return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
to
return substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2);

at least, that worked for me... :)

Focus dammit, I'm trying to focus!

SweetFabrik - True believer of Zen Cart!

http://www.last.fm/user/beez/

8 Aug 2006, 12:20 AM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: date in swedish

Were you unable to make this change in your main language file?

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

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Aug 2006, 12:36 AM
#4
beez avatar

beez

Zen Follower

Join Date:
Sep 2005
Location:
Malmö, Sweden
Posts:
117
Plugin Contributions:
4

Re: date in swedish

Yes, which seems odd... It should be enough to just change there, right? Maybe I didn't got it right...

/includes/languages/swedish.php
@setlocale(LC_TIME, 'sv_SE.ISO8859-1');
define('DATE_FORMAT_SHORT', '%Y-%m-%d'); // this is used for strftime()
define('DATE_FORMAT_LONG', '%A den %e %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');

Do you see anything wrong? When I tried this, with no other changes, the customer weren't able to enter their date of birth as 1972-08-22

Focus dammit, I'm trying to focus!

SweetFabrik - True believer of Zen Cart!

http://www.last.fm/user/beez/

8 Aug 2006, 12:41 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: date in swedish

You can also read up on the Wiki when you have to go beyond it ... which is what I believe you might have been referring to ...

http://www.zen-cart.com/wiki/index.php/Date_Format

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

8 Aug 2006, 9:33 AM
#6
typhoon avatar

typhoon

Zen Follower

Join Date:
Jul 2006
Posts:
144
Plugin Contributions:
0

Re: date in swedish

Beez:

In create_account.php on line 129 change '/' to '-'

In Swedish.php on line 35 change
return substr($date, 3, 2) . substr($date, 0, 2) . substr($date, 6, 4);
to
return substr($date, 8, 2) . substr($date, 5, 2) . substr($date, 0, 4);

and change line 35
return substr($date, 6, 4) . substr($date, 0, 2) . substr($date, 3, 2);
to
return substr($date, 0, 4) . substr($date, 5, 2) . substr($date, 8, 2);

at least, that worked for me... :)

Thanx alot, it works now for 99%. All the years seems to work except 1969. It allways shows as 2037. Same with 1869. it also shows 2037. And it's the same if I create a new user or change for an existing user. Strange ? Yes, very. Any solutions ?

/Typhoon

29 Aug 2006, 6:13 AM
#7
typhoon avatar

typhoon

Zen Follower

Join Date:
Jul 2006
Posts:
144
Plugin Contributions:
0

Re: date in swedish

Typhoon:

Thanx alot, it works now for 99%. All the years seems to work except 1969. It allways shows as 2037. Same with 1869. it also shows 2037. And it's the same if I create a new user or change for an existing user. Strange ? Yes, very. Any solutions ?

Anyone ??

/Typhoon

29 Aug 2006, 9:37 AM
#8
beez avatar

beez

Zen Follower

Join Date:
Sep 2005
Location:
Malmö, Sweden
Posts:
117
Plugin Contributions:
4

Re: date in swedish

No, I have no idea... But I got the same problem, really strange! I'll look in to it and see if I could find anything...

Focus dammit, I'm trying to focus!

SweetFabrik - True believer of Zen Cart!

http://www.last.fm/user/beez/

29 Aug 2006, 10:20 AM
#9
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: date in swedish

Beez:

No, I have no idea... But I got the same problem, really strange! I'll look in to it and see if I could find anything...

I have to still check this account creation related dates but atleast elsewhere the dates in Finnish work only if setlocale is fi_FI.ISO8859-1 instead of fi_FI.ISO_8859-1.
So, I had to remove that underscore between ISO and 8859-1.

Elli

I may be blond but at least I found Zen.

29 Aug 2006, 12:37 PM
#10
beez avatar

beez

Zen Follower

Join Date:
Sep 2005
Location:
Malmö, Sweden
Posts:
117
Plugin Contributions:
4

Re: date in swedish

There got to be a problem in /admin/includes/functions/general.php there is a function that starts on line 164 that has a workaround for years before 1970... But I can't figure out why it gets wrong when I change in /language/swedish.php

I'm using @setlocale(LC_TIME, 'sv_SE.ISO8859-1'); and it's working fine anywhere els...

Focus dammit, I'm trying to focus!

SweetFabrik - True believer of Zen Cart!

http://www.last.fm/user/beez/

29 Aug 2006, 12:56 PM
#11
beez avatar

beez

Zen Follower

Join Date:
Sep 2005
Location:
Malmö, Sweden
Posts:
117
Plugin Contributions:
4

Re: date in swedish

If I change /admin/includes/functions/general.php line 178

return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));

to

return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 1969)));

The same for /includes/functions/functions_general.php line 222

I've made some tests and it seams to be working... Of course it doesn't works for 1896, but I don't I'll that many shoppers with that date of birth :-)

Focus dammit, I'm trying to focus!

SweetFabrik - True believer of Zen Cart!

http://www.last.fm/user/beez/

31 Aug 2006, 8:57 AM
#12
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: date in swedish

Beez:

If I change /admin/includes/functions/general.php line 178

return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 2037)));

> to
> ```
return ereg_replace('2037' . '$', $year, date(DATE_FORMAT, mktime($hour, $minute, $second, $month, $day, 1969)));

The same for /includes/functions/functions_general.php line 222

I've made some tests and it seams to be working... Of course it doesn't works for 1896, but I don't I'll that many shoppers with that date of birth :-)

I tested with the fi_Fi language settings and to me 1969 didn't bring any problems. I didn't then try the fix above because already it was fine. :)

I may be blond but at least I found Zen.

31 Aug 2006, 4:14 PM
#13
typhoon avatar

typhoon

Zen Follower

Join Date:
Jul 2006
Posts:
144
Plugin Contributions:
0

Re: date in swedish

I tried ellivir version to use fi_FI.ISO8859-1 instead of sv_SE.ISO8859-1 but it didn't work, it's 2037 still...

So I tried Beez solution by changing the code and it works fine now, 1969, finally.

But this code change, it won't give me any problems somewhere else now ? :D... Or this only applies for the customers birth date, and only for the year 1969 ?

Otherwise, a super solution ! Thanx alot for all your helps and tips... :clap:

/Typhoon

31 Aug 2006, 5:11 PM
#14
beez avatar

beez

Zen Follower

Join Date:
Sep 2005
Location:
Malmö, Sweden
Posts:
117
Plugin Contributions:
4

Re: date in swedish

I don't think so, but I haven't tested it that thoroughly yet...

I really don't understand why this is happening, especially since there seems to be dealt with in the code...

If anyone find out that my fix isn't working, please let me know...

Cheers!

Focus dammit, I'm trying to focus!

SweetFabrik - True believer of Zen Cart!

http://www.last.fm/user/beez/