MODX Community

tvFilter by part of the Date

Hi there,

I just kind of finished a snippet to filter results of PdoTools (calendar entries) by things like “country” and “type” etc. which users can choose in a dropdown form (formIt).

What I need now is a way to filter my “month and year”, like “may 2020”. All I have is the full timestamp of the event.

How would you set a tvFilter for this?

1 Like

You can convert the timestamps into whatever date format you want, here are some links HTH

and

https://docs.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/template-variables/template-variable-output-types/date-tv-output-type

Thank you for your Input!

The links you provided are about the display of the timestamp / date. What I need is a comparism of a form input (one month / one year / both) and a database field containing a full timestamp. I think that the format of the timestamp is always the same within the MODX database.

does this help?

https://forums.modx.com/thread/102744/getresources-with-tv-date-filter-with-specific-month-and-year

1 Like

I created a custom snippet for creating the tvFilter. I can publish it later when thenI finished the function in the project. Have to hurry a bit, holydays are calling and I have to get ready :slight_smile:

1 Like

By the way:
&tvFilters=EventDateTV==2017-08
Does not work woth pdoResources. You need to do it like this:
&tvFilters=EventDateTV>>2017-08,EventDateTV<<2017-09

1 Like

maybe
&tvFilters=`EventDateTV==2017-08%`