We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1526
    • 72 Posts
    I set up a Template Variable [*workEndYear*] type: number, widget: date formatter, date format: %Y where I wish to store only the year of the date, but this gives me strange output.
    Exhamples:
    editing page -> viewing page
    1998 -> 1998
    2004 -> 2010
    note: going back to edit mode the value seems kept correct.
    what’s wrong?
    thank you
      MODx evo 1.5~1.6 ✪ Apache v 2.2.22 ✪ PHP v 5.3.10 ✪ MySQL v 5.1.61
      <°'iiii);
      • 9207 ☆ A M B ☆
      • 2,475 Posts
      I don’t think you can use the number type here... I think you need the "date" data type.
        • 1526
        • 72 Posts
        I see, but how can I use year only (prefereably both imput and output)?
        Thanks
          MODx evo 1.5~1.6 ✪ Apache v 2.2.22 ✪ PHP v 5.3.10 ✪ MySQL v 5.1.61
          <°'iiii);
          • 4172
          • 5,888 Posts
          if you need a number for year only you can make a dropdown-tv for example with input-option-values:

          @EVAL for ($year=2000;$year<2050;$year++){$output[]=$year;} return $output;


            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!