We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21257 MODX Staff
    • 730 Posts
      Mike Schell
      Lead Developer, MODX Cloud
      Email: [email protected]
      GitHub: https://github.com/netProphET/
      Twitter: @mkschell
      • 4749
      • 623 Posts
      I sad to report that updating MySQL did not do the trick. I wonder if there’s a trigger for this behavior. If anyone has any other thoughts, please share! Thanks.
        The MODx has you...
        Utah Web Design
        • 4749
        • 623 Posts
        I’ve reinstalled, rolled back, and done just about everything I can think of doing. Does anyone have a clue as to what it might be?
          The MODx has you...
          Utah Web Design
          • 4749
          • 623 Posts
          OK, I really need to roll this site out, but I can’t do it with the bad dates. Interestingly enough I installed the sitemap snippet and it outputs the correct date on all the documents. So, this leads me to believe that it is an issue with Ditto, but I just can’t pinpoint it. If someone could help me troubleshoot and solve this I’d greatly appreciate it.

          - Desperate huh
            The MODx has you...
            Utah Web Design
            • 7231
            • 4,205 Posts
            I recommend that you strip down the call and see if it is not a conflict between components (tags, filters etc.). Try the call like this:
            [!Ditto? &parents=`8,12,44,180,181,182,183,184,185` &tpl=`Coverage` &display=`2` &extenders=`summary,dateFilter` &dateSource=`pub_date` &dateFormat=`%B %e, %Y` &orderBy=`pub_date DESC` !]
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don't know what it is.
              Do you, Mr. Jones? - [bob dylan]
              • 4749
              • 623 Posts
              Nothing changes... Ugh. :’(
                The MODx has you...
                Utah Web Design
                • 4749
                • 623 Posts
                Despite all of the help I got from netProphET (a big thank you), still not working. However, we did find out some interesting things. It seems Ditto is ignoring the output format. For example:
                &dateFormat=`%Y`

                still shows up as:
                &dateFormat=`%B %e, %Y`


                [+date+] will return December 31, 1969

                [+pub_date+] will return the timestamp

                  The MODx has you...
                  Utah Web Design
                  • 4172
                  • 5,888 Posts
                  if there is no other way why do you not format the [+pub_date+] with PHx?
                  is dateFormat working when you call ditto without the extenders (dateFilter,summary)?
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 4749
                    • 623 Posts
                    well, currently I am using PHx to format the date, but that still doesn’t solve the problem it’s only a band aid. And while I’ll gladly use the band aid I’d still like to know why it isn’t working. Besides, the reflect snippet is outputting 1969 also and I don’t know of any PHx modifiers that’ll work on that.

                    Oh, and to answer your question - with or without the extender it does the same.

                    Thanks.
                      The MODx has you...
                      Utah Web Design
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Make a php file with this code
                      $dateFormat = '%B %e, %Y';
                      $dateUnixTime = 'put the timestamp here';
                      echo  strftime($dateFormat, (intval($dateUnixTime) + <put your server offset from the MODx configuration here>));
                      

                      and see what happens. (you might need to adjust that server offset business a bit; I’m not sure what value would be returned by the $modx->config["server_offset_time"])
                      The ditto class function in question is
                      	function formatDate($dateUnixTime, $dateFormat) {
                      		global $modx;
                      		$dt =  strftime($dateFormat, (intval($dateUnixTime) + $modx->config["server_offset_time"]));
                      		if ($modx->config["modx_charset"] == "UTF-8") {
                      			$dt = utf8_encode($dt);
                      		}
                      		return $dt;
                      	}
                      
                        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