• 1s0s.com

    (@nsanden)


    When i use echo date(“d”); in any place of my blog I get the next day (at least right now at 8:15pm on the 5/24/2012).

    First thought was maybe my server time is wrong, but I checked that and it confirms: root@server1 [~]# date
    Thu May 24 20:16:49 PDT 2012

    Then i thought maybe my timezone was wrong in wordpress settings and it was set to UTC-7 so I changed that to America – Los Angeles but it didn’t fix it still. Also when creating a post, it used the 24th.

    Then I thought maybe my php.ini setting was wrong, but I checked that and its using: date.timezone=”America/Los_Angeles”

    Anyone have any other ideas, is this something simple i’m missing? Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • vtxyzzy

    (@vtxyzzy)

    Try using date_i18n() instead of date().

    Thread Starter 1s0s.com

    (@nsanden)

    Hi, this worked, thank you. So what does that mean? Why isn’t date() working like expected?

    vtxyzzy

    (@vtxyzzy)

    As I understand it, the Linux/Unix date command, and date_i18n(), take into account the timezone. The PHP date() function does not.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Wrong day outputted for date("d");’ is closed to new replies.