Solved

setlocale & strftime

Posted on 2003-12-03
8
625 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 24

Expert Comment

by:shivsa
ID: 9872594
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
ID: 9872607
also check if
language_country exists in the /usr/share/locale/locale.alias
0
 

Author Comment

by:mkag
ID: 9873109
not working
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 6

Expert Comment

by:aolXFT
ID: 9877801
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
 
LVL 6

Expert Comment

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

Author Comment

by:mkag
ID: 9880432
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
ID: 9880493
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
ID: 9881748
thanks working
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 dynamically set the form action using jQuery.

726 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