PHP Code Widget
[resolved] Strange situation with results.. date func php (3 posts)

  1. vigilant_spb
    Posted 3 years ago #

    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?


  2. Samuel Wood (Otto)
    WordPress.org Tech Dude
    Plugin Author

    Posted 3 years ago #

    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.

  3. vigilant_spb
    Posted 3 years ago #

    Thank you, Samuel!

    Now I see, thanks for your quick answer! Actually it's even good in my case, some "delay" is ok :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.