Solved

setlocale & strftime

Posted on 2003-12-03
8
618 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

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