[Perl] Multilingual date
Reuven M. Lerner
reuven at lerner.co.il
Wed Feb 13 06:47:04 PST 2002
>>>>> Shlomo Yona writes:
Shlomo> Thanks for your answer. I tried that. Tried that even with
Shlomo> another locale, yet I still get the days in English and not
Shlomo> in the locale language. Perhaps I'm doing something wrong?
Well, I just tried this on my Linux box (Red Hat 7.2) with the stock
RPM version of Perl 5.6.0:
% export LC_ALL=en_US
% export LANG=en_US
% perl -w
use POSIX qw(strftime);
$now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;
print "'$now_string'\n";
I got:
'Wed Feb 13 16:44:28 2002'
Then I tried:
% export LC_ALL=cs_CZ
% export LANG=cs_CZ
% perl -w
use POSIX qw(strftime);
$now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;
print "'$now_string'\n";
I got:
'St úno 13 16:45:36 2002'
So the code in the documentation clearly works. The question is
whether (a) locales are set up on your machine, (b) whether you're
setting the locale correctly, and (c) whether your version of Perl is
somehow broken.
Reuven
More information about the Perl
mailing list