We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29525
    • 388 Posts
    Can PHx and GetField work together?

    I have a date field (day2) with a unixtime widget in one document and a time field (day2time), a text field, in another document.

    I’ve used PHx to display the date and time if there is a value in the time field. So far so good.

    [+phx:if=`[*day2time*]`:isnot=``:then=`[[GetField? &docid=`9` &field=`day2`]], [*day2time*] <br />`+]

    The date field field retrieved with GetField displays the unixtime and I want to format the date with this
    [*day2:date=`%a  %b %d`*] 

    The date field is in unixtime because I use it in several places that require different date formats.

    I’ve tried a bunch of ways to apply PHx date to the output of the GetField with no success.

    Is there a way to use PHx to change the date format retrieved with GetField?
      www.terrybarthdesign.com
      • 20413
      • 2,877 Posts
      Could you not use a field with the date formatter widget?
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 6726
        • 7,075 Posts
        Yes I have used GetField this way countless times with PHx, it works.

        The problem is definitely date formatting in your case... date formatter could indeed be the simplest option
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 29525
          • 388 Posts
          Guys, thanks for helping me with this.

          I would definitely use date formatter if I can.

          I removed the date formatter widget because in one place I need a full text date such as Wednesday, September 15 but in another place I want the same date to be Wed Sep 15.

          When I use date formatter I get the same date output in both places and I can’t get PHx to reformat the output from the widget. So I switched the TV to unixtime so I could use PHx on both places.

          Am I thinking about this right?
            www.terrybarthdesign.com