We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4749
    • 623 Posts
    I posted a similar question in the Ditto forum with no luck, but also realized that it may not be a Ditto issue. [+pub_date+] will output 1969. Here’s the topic: http://modxcms.com/forums/index.php/topic,26583.0.html  I really need to get this solved and just can’t get my footing. I’ve checked the DB and everything is OK there. I attempted to dissect the Ditto call, but quickly realized that it was a sitewide problem. So, I contacted my host, but there have been no changes for almost three weeks. The dates were working a few days ago and I’ve been trying to sort through any changes I’ve made, but have had no luck. I can’t determine the cause and all the posts that I’ve read about this problem show different symptoms and within different plugins, snippets, or modules. So, please...If you have ANY insight please share. Thank you.
      The MODx has you...
      Utah Web Design
      • 21257 MODX Staff
      • 730 Posts
      Since you have &dateSource=`pub_date` in your Ditto call, Ditto should be using pub_date for it’s [+date+] placeholder. Do you get 1969 with [+date+] in your Ditto templates?

      Also, you say this is happening sitewide.. so if, in the manager, you edit some document, see a valid Publish Date, put [*pub_date*] somewhere in the content of document, you see 1969 in the document output?

      Do you also see 1969 for the output of other dates like [*createdon*] or [*editedon*] ?
        Mike Schell
        Lead Developer, MODX Cloud
        Email: [email protected]
        GitHub: https://github.com/netProphET/
        Twitter: @mkschell
        • 4749
        • 623 Posts
        Yes, I get 1969 in the [+date+] placeholders for ditto. Also, if I put in [*createdon*], [*editedon*], or [*pub_date*] in the document I get a unix time stamp 1211401876. Weird isn’t it?
          The MODx has you...
          Utah Web Design
          • 21257 MODX Staff
          • 730 Posts
          Quote from: cbaone at Jun 17, 2008, 01:03 PM

          Yes, I get 1969 in the [+date+] placeholders for ditto. Also, if I put in [*createdon*], [*editedon*], or [*pub_date*] in the document I get a unix time stamp 1211401876. Weird isn’t it?
          Yes, weird that [+date+] and [+pub_date+] aren’t working for you in Ditto. But getting the timestamp output on those other doc variables is correct.

          Just going out on a limb, but what would happen if you installed the getField snippet:
          http://modxcms.com/getField-1.3-beta-1189.html

          and in your Ditto template, where you would put [+date+], you put [[GetField? &docId=`[+id+]` &field=`pub_date`]]

          That’s just mainly to get a better idea of what’s going on. Even if it returns a timestamp, you won’t be able to format it easily. But if it does return the timestamp, then as a workaround to this problem, you could write a custom snippet that did a similar thing to the GetField call, but formatted the date how you want.
            Mike Schell
            Lead Developer, MODX Cloud
            Email: [email protected]
            GitHub: https://github.com/netProphET/
            Twitter: @mkschell
            • 4749
            • 623 Posts
            Adding the get field snippet returns 0. There is no timestamp, so what does that mean?

            EDIT: I put in [+pub_date+] instead of [+date+] for the blog and get a timestamp.
              The MODx has you...
              Utah Web Design
              • 21257 MODX Staff
              • 730 Posts
              Now if you have a timestamp showing up where you want a formatted date, you could install PHx and do date formatting with it.
              http://wiki.modxcms.com/index.php/PHx

              i.e.
              [+pub_date:date=`%a %B %d, %Y at %H:%M`+]
                Mike Schell
                Lead Developer, MODX Cloud
                Email: [email protected]
                GitHub: https://github.com/netProphET/
                Twitter: @mkschell
                • 4749
                • 623 Posts
                If that works that would be great, so thank you for the suggestion. However, I still don’t know why it’s not working anymore. Even if I got it to work, it would still bug me not knowing why it stopped in the first place. Many thanks.
                  The MODx has you...
                  Utah Web Design
                  • 21257 MODX Staff
                  • 730 Posts
                  I totally understand, believe me grin
                    Mike Schell
                    Lead Developer, MODX Cloud
                    Email: [email protected]
                    GitHub: https://github.com/netProphET/
                    Twitter: @mkschell
                    • 4749
                    • 623 Posts
                    I didn’t know if this was a ditto problem, ModX problem, or server/MySQL issue, so I posted here and a previous post in the Ditto forum here:
                    http://modxcms.com/forums/index.php/topic,26583.0.html

                    But, what I did was create a custom date tv just to test it and putting that in the document worked. So, at least I think I have it narrowed down to a Ditto issue, I think. It’s what I suspected in the first place, yet I have to be sure. I may be naive enough to think that it means Ditto, but I would be more than happy to have someone tell me how wrong I am as long as I can get this annoying problem fixed.

                    I have reinstalled ModX already, so I’m going to reinstall Ditto and all it’s files to see if maybe there was some corruption somewhere. I’ll post back my results. Thanks.
                      The MODx has you...
                      Utah Web Design
                      • 4749
                      • 623 Posts
                      I was curious to see how the system itself was handling dates. I went into both the ’Manager Users’ and ’Web Users’. Well, the ’Manager users’ displayed the correct ’Last Login’ dates, but the ’Web Users’, created by WebLoginPE, displayed the 1969 date. Hopefully this will give somebody more insight into what’s going on.
                        The MODx has you...
                        Utah Web Design