We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9372
    • 15 Posts
    In my settings i have set the time to be +6 hours of the sever time so it becomes my local time, but when i view my site its still the sever time and not the updated time. what do i do?
      -----------------------

      If only life was simple......
      • 9372
      • 15 Posts
      anyone going to help?
        -----------------------

        If only life was simple......
        • 4041
        • 788 Posts
        the time shown on the front page is not associated with the manager time settings, it is controlled independently by the snippet DateTime.

        to adjust the time open the DateTime snippet in the manager and find this line:

        if(!isset($timestamp)) {
            $timestamp=time();
        }


        add +21600 and it should look like this:

        if(!isset($timestamp)) {
            $timestamp=time()+21600;
        }

          xforum
          http://frsbuilders.net (under construction) forum for evolution
          • 7923
          • 4,213 Posts
          you can also access the manager setting using [(server_offset_time)] tag or $modx->config[’server_offset_time’], so you could use that in the snippet when fixin it..


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 22815
            • 1,097 Posts
            Indeed. Here is such a fixed snippet.
            /**
             * DateTime 
             * Makes a date and time... thingy. Now even thingier.
             * Original author unknown.
             * 1.01 amended 08Aug06 by Paul Gregory, inspired by doze & breezer.
             */
            $format= (!isset($format)) ? "%d-%m-%Y %H:%M:%S" : "$format";
            
            if(!isset($timestamp)) {
                $timestamp=time();
            }
            
            return strftime($format, $timestamp+$modx->config['server_offset_time']);
            

            I’ll add it to the Repo and I’ll see if I can get that in 0.9.5.
            Does anyone know who wrote this snippet? I know it’s like the easiest snippet in teh world, but still.

            Oh, and you can now pass a different timestamp format through.
              No, I don't know what OpenGeek's saying half the time either.
              MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
              Forum: Where to post threads about add-ons | Forum Rules
              Like MODx? donate (and/or share your resources)
              Like me? See my Amazon wishlist
              MODx "Most Promising CMS" - so appropriate!
              • 9372
              • 15 Posts
              thanks PaulGregory, worked a treat! grin
                -----------------------

                If only life was simple......
                • 4041
                • 788 Posts
                The DateTime snippet was written by Alex Butter and first appeared in phase06_rc1 back in August 2004 wink
                  xforum
                  http://frsbuilders.net (under construction) forum for evolution