⚠️ Urgent! Active Attacks on MODX Revolution Sites Below Revolution 2.6.5

Answered Time zone issue

Subscribe: RSS
  • Hi there,

    I have a page which publishes a resource at a specific time each week.

    I'm in the UK and we are currently on British Summer Time.

    So if I want the resource to get published at 5pm, i need to set the publish time at 4pm.
    I've checked my server, and it knows that the time is 5pm, but if I add this to my page:
    [[!+nowdate:default=`now`:strtotime:date=`%c`]]
    


    It print the time as being 4pm!

    In system settings there are two settings:
    Default Time Zone: date_timezone
    Server offset time: 0


    I tried changing the server offset time to 1 to correct it, but this seems to do nothing.
    Even if it DID work, it's not a good solution, because I would have to remember to change it back when the clocks go back or forward (twice a year).

    Any ideas why it's showing a different time to the server time?


    Thanks!
    Andy

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      Try setting the date_timezone System Setting to "Europe/London" (without the quotes).

      If that doesn't do it, try adding this line to a php.ini file in the MODX root (create one if necessary):

      date.timezone = "Europe/London"


      If that doesn't work, check the Date section of PhpInfo() (Manage -> Reports -> System Information -> phpinfo() link) to see what time PHP thinks it is.

        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/MODx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • ha was just gonna say check php time on server side
        • Quote from: BobRay at Jun 13, 2018, 09:42 PM
          Try setting the date_timezone System Setting to "Europe/London" (without the quotes).

          If that doesn't do it, try adding this line to a php.ini file in the MODX root (create one if necessary):

          date.timezone = "Europe/London"


          If that doesn't work, check the Date section of PhpInfo() (Manage -> Reports -> System Information -> phpinfo() link) to see what time PHP thinks it is.


          Thanks Bob. The first option worked by setting the date_timezone System Setting to "Europe/London"
          So thank you for that! (I always assumed it would inherit the timezone et by the server)

          I have had a look at the pInfo() within reports, but all I can find is under Date it says 'Default timezone Europe/London'
          I can't find anywhere where it prints what time it thinks it is.

          But the main thing is that your first solution worked. so thank you!

          Andy
          • Sorry, I mis-wrote. I meant what timezone PHP thinks it is, not what time.

            Glad you got it sorted. smiley
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/MODx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
            • Quote from: BobRay at Jun 14, 2018, 09:45 PM
              Sorry, I mis-wrote. I meant what timezone PHP thinks it is, not what time.

              Glad you got it sorted. smiley

              Ah Ok - thanks Bob!