Date as a constraint - not working

Hi, I wonder if someone could help me out with a small issue.

I would like my app to show a “Question of the day” to the users. On the admin side I have stored various questions in the database, and each Question type has, in addition to the QuestionText field, a PostDate field - which indicate at what day this question shall be posted:

Here is how it looks in the database (questions for example purpose):

I want my app to show the question that corresponds to the current date, and I thought this was going to be easy peasy, but somehow I’m not able to display the right question in the group.

If I perform a Search for Questions:first item it picks the first Question in the database and displays it correctly in the group - but when I put a constraint like PostDate= Current date/time on the search function in order to achieve what I want, it shows nothing in the group on the front end:

So yeah, I’m sure I’m doing something backwards :face_vomiting:

Any tips?

Your post date defaults to the day alone, not the time which explains why you have 12:00 am in the postdate’s time

The current date/time refers to the actual time as of this moment.

In your search for questions, change the postdate’s constraint to rounded down to day so your constraint will default to “12:00 AM”

1 Like

A date is a precise moment in time…

Current Date/Time means now, right this millisecond.

So searching for things with a post date of the current date time, means things with a post date of the precise millisecond the search is made.

Most likely, you just want to round the current date/time down to day and use that for the value of your constraint.

1 Like

That worked!

Thank you @ntabs and @adamhholmes for sharing your wisdom with me!

2 Likes