We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40045
    • 534 Posts
    Quote from: absent42 at Mar 30, 2013, 01:06 PM
    Quote from: exside at Mar 25, 2013, 06:12 PM
    if anybody knows 1. where to find them in the code (I tried everywhere I could, but couldn't find any hardcoded strings like "today" and "now" in files that have to do with dateTV types)

    Poked around and they're in /core/model/modx/filters/modoutputfilters.class.php

    There's code for 'fuzzydates' and 'ago'. Line 456 and 474.

    just checked and I'm not sure, couldn't find keyword "tomorrow" and "now" plus the outputfilters class would really be strange place to have something like this in as this doesn't seem to have much to do with document variables rendering in the manager^^, but at least you found something =))...better than I did^^
      • 42046
      • 436 Posts
      My initial thought is that it might just be an inherited function of the standard php strtotime that's used by MODX. That accepts tomorrow, yesterday, fortnight, now & today in it's input. Might also explain why it's not explicitly stated in the documentation as a specifically designed feature of MODX, and why a keyword search of all the MODX code comes up lacking.
        • 40045
        • 534 Posts
        Quote from: absent42 at Mar 30, 2013, 10:05 PM
        My initial thought is that it might just be an inherited function of the standard php strtotime that's used by MODX. That accepts tomorrow, yesterday, fortnight, now & today in it's input. Might also explain why it's not explicitly stated in the documentation as a specifically designed feature of MODX, and why a keyword search of all the MODX code comes up lacking.

        This is the best explanation until now =), have to try further, maybe with these http://www.the-art-of-web.com/php/strtotime/#.UVhH3pB4MXw

        So then you're right, it would not be a modx specific feature but I think stuff like this belongs to the rtfm anyways, just in case you want to do something like that and you're pulling hair bc it's just not noted somewhere that "you can use strtotime like keywords in your date TV's default value if you like to set it to a specific date/time initially"... [ed. note: exside last edited this post 11 years, 1 month ago.]
          • 3749
          • 24,544 Posts
            Did I help you? Buy me a beer
            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
            • 40045
            • 534 Posts
            Actually because this is primarily for the manager I've put it here a week ago (or so): http://rtfm.modx.com/display/revolution20/Template+Variable+Input+Types#TemplateVariableInputTypes-Date

            but I need further testing of "keyword"/values regarding strtotime, then I'll update that...

            Quote from: BobRay at Mar 31, 2013, 07:46 PM
            That would maybe belong here: http://rtfm.modx.com/display/revolution20/Date+Formats

            or here: http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+(Output+Modifiers)

            (or both).
              • 51328
              • 13 Posts
              Did it work for someone? I also search a way to store the createdon date in a date TV's default value. It's kind of the same problem. It doesn't even seem to work when I enter a time stamp for the default value.
                • 3749
                • 24,544 Posts
                Dates are stored as timestamps, but when you enter them, they need to be human-readable dates. They're converted to timestamps when saved to the DB.

                I'm having trouble figuring out why you'd want that in a date TV since it's already stored in the createdon field, which is much faster to retrieve.
                  Did I help you? Buy me a beer
                  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
                  • 51328
                  • 13 Posts
                  Quote from: BobRay at May 08, 2016, 12:45 AM
                  Dates are stored as timestamps, but when you enter them, they need to be human-readable dates. They're converted to timestamps when saved to the DB.

                  I'm having trouble figuring out why you'd want that in a date TV since it's already stored in the createdon field, which is much faster to retrieve.

                  I want to sort with getResources in chronological order. For some articles I want to change the date because that "happened" in the past. Then I have to sort with two date arguments - createdon for articles where date is the actual date the article was created and articles with the date tv. With getResource using two sort arguments doesn't really work because it first sorts all articles with the tv and then those with createdon. So I am trying two write the creatdon date into the date tv. I then can sort only with that date tv and my articles should be in right order.
                    • 51328
                    • 13 Posts
                    @EVAL return $modx->resource->getOne('CreatedOn'); also didn't do the trick. I always get 1-1-1970 as date for the date tv sad
                      • 51328
                      • 13 Posts
                      "@CHUNK MyChunk" with "[[+createdon:strtotime:date=`%d-%m-%Y`]]" also didn't work. When entering dd-mm-yyyy as standard value it works. Maybe when accessed by getResources the tv doesn't know to which resource it belongs.