Solved

setlocale & strftime

Posted on 2003-12-03
8
615 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
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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

864 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

24 Experts available now in Live!

Get 1:1 Help Now