# Date as a constraint - not working

**URL:** <https://forum.bubble.io/t/date-as-a-constraint-not-working/299805>\
**Category:** Database\
**Created:** [December 30, 2023, 1:41pm UTC](https://forum.bubble.io/t/date-as-a-constraint-not-working/299805 "2023-12-30T13:41:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rudibakken](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rudibakken/32/173531_2.png) [@rudibakken](https://forum.bubble.io/u/rudibakken)\
**Post date:** [December 30, 2023, 1:41pm UTC](https://forum.bubble.io/t/date-as-a-constraint-not-working/299805/1 "2023-12-30T13:41:49Z")

</div>

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:

 ![Skjermbilde 2023-12-30 kl. 14.23.10](https://us1.discourse-cdn.com/bubble/original/3X/9/c/9cf17fddb211c0428c82b714276904b99e7a7a46.png)

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

 ![Skjermbilde 2023-12-30 kl. 14.27.21](https://us1.discourse-cdn.com/bubble/original/3X/0/e/0e55ccc84a414c48ab7d265c95d6191aec955356.png)

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:

 ![Skjermbilde 2023-12-30 kl. 14.35.55](https://us1.discourse-cdn.com/bubble/original/3X/e/2/e2c8f93bba1a813c94acf6384ad1e873c828661c.png)

 ![Skjermbilde 2023-12-30 kl. 14.39.30](https://us1.discourse-cdn.com/bubble/original/3X/3/b/3b1dfe4ccbda0685292d9e60007a5e9356e967d3.png)

So yeah, I’m sure I’m doing something backwards 🤮

Any tips?

---

<div class="post-metadata">

**Author:** ![ntabs](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@ntabs](https://forum.bubble.io/u/ntabs)\
**Post date:** [December 30, 2023, 1:48pm UTC](https://forum.bubble.io/t/date-as-a-constraint-not-working/299805/2 "2023-12-30T13:48:49Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [December 30, 2023, 1:54pm UTC](https://forum.bubble.io/t/date-as-a-constraint-not-working/299805/3 "2023-12-30T13:54:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rudibakken](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/rudibakken/32/173531_2.png) [@rudibakken](https://forum.bubble.io/u/rudibakken)\
**Post date:** [December 30, 2023, 1:58pm UTC](https://forum.bubble.io/t/date-as-a-constraint-not-working/299805/4 "2023-12-30T13:58:15Z")

</div>

That worked!

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