Solved

setlocale & strftime

Posted on 2003-12-03
8
609 Views
Last Modified: 2013-12-13
if I host following PHP script on Windows it is working fine i.e. output is  "Donnerstag, 04. Dezember 2003" as I want

setlocale(LC_TIME , 'de_DE@euro', 'de_DE', 'de', 'ge');
echo strftime("%A, %d. %B %Y");

But when I host it on Red Hat Linux output is following-

Thursday, 04. December 2003

Any help?
0
Comment
Question by:mkag
  • 3
  • 3
  • 2
8 Comments
 
LVL 24

Expert Comment

by:shivsa
Comment Utility
because locale naming is different on redhat and windows.

try with
setlocale(LC_TIME , 'de@euro', 'de', 'de', 'ge');
0
 
LVL 24

Expert Comment

by:shivsa
Comment Utility
also check if
language_country exists in the /usr/share/locale/locale.alias
0
 

Author Comment

by:mkag
Comment Utility
not working
0
 
LVL 6

Expert Comment

by:aolXFT
Comment Utility
I don't have redhat, but check if the country is in /usr/share/locale/locale.gen, if not, it hasn't been generated.

The information was put across as Debian Related, and my server where I tested it is also Debian.

I don't know how it applies, if at all to RedHat.

What version of RedHat are you using?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:aolXFT
Comment Utility
You'll probably have to get the admin to install a de_DE locale RPM.
0
 

Author Comment

by:mkag
Comment Utility
I have already installed it. I wrote a simple C program to test it. It was working fine but for PHP it is not working.

I have PHP 4.2

0
 
LVL 24

Accepted Solution

by:
shivsa earned 250 total points
Comment Utility
could u try this.

putenv("LANG=de_DE");
putenv("LANGUAGE=de_DE");
putenv("LC_ALL=de_DE");
setlocale(LC_ALL, "de_DE", "german");
setlocale(LC_TIME , 'de_DE@euro', 'de_DE', 'de', 'ge');
echo strftime("%A, %d. %B %Y");



0
 

Author Comment

by:mkag
Comment Utility
thanks working
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now