We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13825
    • 55 Posts
    Ok so I’ve creating a module and I’ve used a date() function and I get this error although the module runs:
    It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ’UTC’ for ’GMT/0.0/no DST’ instead

    Can someone please explain what that mean... there must be a way to use date functions in a module surely???

    Thanks smiley

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      http://il.php.net/date_default_timezone_set

      Put this somewhere near the beginning of your snippet, before your call to time(). Check the link to the List of Supported Timezones for the one appropriate to your site.

      One example given
      Of course this is a problem that recently surfaced since PHP5. Quick fix is to set your time zone, add this line to your php code:

      date_default_timezone_set("America/Los_Angeles");
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 13825
        • 55 Posts
        Thanks!!!!!

        So does this need to go into the main modx index.php file for servers running php5?

        Related to this was a function called Window.onDomReady being called obviously to give a system alert about the date error but I was getting a javascript error "Window.onDomReady is not a function". Any ideas why this function didn’t work. I’m assuming there’s a file it’s referencing that doesn’t exist??

        very confusing when a standard php function results in a javascript error! tongue

        This is my first module so sorry if these are really easy questions. smiley
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          It probably should be one of the options set in the installation.

          Yeah, when Javascript gets involved things can get complicated.

          http://forum.mootools.net/viewtopic.php?id=1830
          http://forum.joomla.org/index.php/topic,173152.0.html
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org