Support » Plugin: PHP Code Widget » Strange situation with results.. date func php

  • Resolved vigilant_spb


    Strange thing.

    I have php code inserted in widget, it works but right now (at this moment) function date(j) returns 22..
    when I run the same (copypaste) php code in the separate file on the same server – it’s 23.. 🙂

    How is it possible? Widget is not cached (I changed echo text in the code – can see the update). But why does the date works that way?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Samuel Wood (Otto)


    WordPress standardizes the timezone of the system to GMT in order to produce consistent date calculations and to be able to handle daylight savings appropriately.

    You can use date_i18n() in WordPress to produce the same result, but with the correct time, and also localized according to your language pack (if you have one). It takes the timezone settings of WordPress into account.

    Thank you, Samuel!

    Now I see, thanks for your quick answer! Actually it’s even good in my case, some “delay” is ok 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Strange situation with results.. date func php’ is closed to new replies.