We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15987
    • 786 Posts
    I have been trying to use a date template variable in my query hook and cannot seem to get it to work. Has anyone had any luck setting up a date tv as a way to filter results?

    here are what my conditions look like:

    $andConditions = array(
        'tv.stlrooms:=' => 'rooms:request:all',
        'tv.stldatefrom:<=' => 'stldatefrom:request',
        'tv.stldateto:>=' => 'stldateto:request'
    );
    


    I am passing in a unix timestamp into the two date request variables.

    Any help would be much appreciated.
      • 5811
      • 1,717 Posts
      Have you added the stldatefrom and stldateto TVs inside the withTVs parameter ?

      Are you sure that the stldatefrom and stldateto values inside the site_tmplvar_contentvalues table are stored as int (timestamp) rather than as a date.
        • 15987
        • 786 Posts
        Yes, I did add them to the the withTvs parameter.

        I will have to look and see about how the data is stored, I am just using the standard date TV type. But I have no idea how that actually stores its data.