setlocale() has no effect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gustaf Liljegren

    #1

    setlocale() has no effect

    Trying to get a date in Swedish, but this won't work:

    $unix_time = strtotime($dt_c reated);
    setlocale(LC_TI ME, 'sv', 'sve', 'swe', 'sv_SE');
    $time = strftime('%A den %d %B', $unix_time);

    No matter what I put in setlocale(), I get English weekdays and months.
    I'm using PHP 4.3.8 on a UNIX computer, but I'm not in control of the
    installation.

    Gustaf
  • Michael Fesser

    #2
    Re: setlocale() has no effect

    .oO(Gustaf Liljegren)
    [color=blue]
    >Trying to get a date in Swedish, but this won't work:
    >
    > $unix_time = strtotime($dt_c reated);
    > setlocale(LC_TI ME, 'sv', 'sve', 'swe', 'sv_SE');
    > $time = strftime('%A den %d %B', $unix_time);
    >
    >No matter what I put in setlocale(), I get English weekdays and months.
    >I'm using PHP 4.3.8 on a UNIX computer, but I'm not in control of the
    >installation .[/color]

    Is a Swedish locale installed on that machine?

    Micha

    Comment

    • Gustaf Liljegren

      #3
      Re: setlocale() has no effect

      Michael Fesser wrote:
      [color=blue]
      > Is a Swedish locale installed on that machine?[/color]

      I'm not sure about that, and frankly, I don't know how to find out. Can
      I see it in phpinfo()? Thanks for helping.

      Gustaf

      Comment

      • steve

        #4
        Re: Re: setlocale() has no effect

        "Gustaf Liljegren" wrote:[color=blue]
        > Michael Fesser wrote:
        >[color=green]
        > > Is a Swedish locale installed on that machine?[/color]
        >
        > I’m not sure about that, and frankly, I don’t know how to
        > find out. Can
        > I see it in phpinfo()? Thanks for helping.
        >
        > Gustaf[/color]

        If no answers, the function can be easily written.

        --
        http://www.dbForumz.com/ This article was posted by author's request
        Articles individually checked for conformance to usenet standards
        Topic URL: http://www.dbForumz.com/PHP-setlocal...ict139719.html
        Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=467434

        Comment

        • Chung Leong

          #5
          Re: setlocale() has no effect

          "Gustaf Liljegren" <gustafl@algone t.se> wrote in message
          news:cfm8kj$cet $1@green.tninet .se...[color=blue]
          > Michael Fesser wrote:
          >[color=green]
          > > Is a Swedish locale installed on that machine?[/color]
          >
          > I'm not sure about that, and frankly, I don't know how to find out. Can
          > I see it in phpinfo()? Thanks for helping.
          >
          > Gustaf[/color]

          The fact that setlocale() doesn't work seems to indicate that it wasn't.

          In general it's best to avoid using setlocale() since it's very system
          dependent.


          Comment

          • Gustaf Liljegren

            #6
            Re: setlocale() has no effect

            steve wrote:
            [color=blue]
            > If no answers, the function can be easily written.[/color]

            Yes, I did. Problem solved. :-)

            Comment

            Working...