0

With following source code I get different outputs on dev (local-maxOSX) and live (debian):

setlocale(LC_TIME, 'de_DE' ); 
$intervalOutput = strftime('%a %d.%m. %H:%M', $start->getTimestamp());
echo $intervalOutput;

local (correct formatting of the day): Do 01.03. 20:00

live server (incorrect- i need german weekday output): Thu 01.03. 20:00

Can someone tell my why this happens?

stoefln
  • 14,498
  • 18
  • 79
  • 138
  • 2
    Does it work with `LC_ALL` instead? – 472084 Feb 09 '12 at 10:48
  • 2
    Check if the german language pack is installed on your debian machine. And dont' forget the charset : setlocale(LC_TIME, 'de_DE.UTF8'); – BMN Feb 09 '12 at 10:49
  • @tsabz: ouch: now the behaviour reversed! the date is formatted correctly on the live system and on the dev system it outputs the weekday in EN. it already worked on my dev system- so actually there should not be any need for installing something IMO... any ideas? – stoefln Feb 09 '12 at 15:27
  • @Jleagle no that does not change anything – stoefln Feb 09 '12 at 15:27
  • The syntax with the .UTF8 included is for debian machines. I'm not sure if it's supported on OSX. Try without on your dev machine. – BMN Feb 09 '12 at 16:55

3 Answers3

1

try using date_default_timezone_set or try using LC_ALL

1

I thought this worked for me (thats why I wrote this answer here), but later on I realised that this is not working on the dev (OSX) machine now. (So I just edited this answer) You can try it anyway:

1.) installing locales on the live server (as root):

aptitude install debconf
dpkg-reconfigure locales

2.) changing:

setlocale(LC_TIME, 'de_DE')

to

setlocale(LC_TIME, 'de_DE.UTF8')

The reason why this is not working for me, seems to be that on OSX the locale is called "de_DE.utf-8" whereas it is called "de_DE.UTF8" on the debian machine.

stoefln
  • 14,498
  • 18
  • 79
  • 138
0

Try the following on both machines.

$loc_de = setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
echo "Preferred locale for german on this system is '$loc_de'";
Josnidhin
  • 12,469
  • 9
  • 42
  • 61