[Perl] Multilingual date

Reuven M. Lerner reuven at lerner.co.il
Wed Feb 13 02:46:56 PST 2002


>>>>> Shlomo Yona writes:

  Shlomo> I am looking for a way to get a date in Perl, which is
  Shlomo> sensitive to the locale used.  What I mean, is, if I'm with
  Shlomo> a Frech locale, I'll get the answer using French
  Shlomo> conventions, and If my locale is German, I will get the date
  Shlomo> using German conventions.

Here's what it says at the bottom of "perldoc -f localtime":

    To get somewhat similar but locale dependent date strings, set up
    your locale environment variables appropriately (please see
    perllocale) and try for example:

    use POSIX qw(strftime);
    $now_string = strftime "%a %b %e %H:%M:%S %Y", localtime;

    Note that the %a and %b, the short forms of the day of the week
    and the month of the year, may not necessarily be three characters
    wide.

Reuven



More information about the Perl mailing list