# How to apply a condition based on last items created date

**URL:** <https://forum.bubble.io/t/how-to-apply-a-condition-based-on-last-items-created-date/214000>\
**Category:** Questions\
**Created:** [July 4, 2022, 1:18pm UTC](https://forum.bubble.io/t/how-to-apply-a-condition-based-on-last-items-created-date/214000 "2022-07-04T13:18:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosewaterbrands](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@rosewaterbrands](https://forum.bubble.io/u/rosewaterbrands)\
**Post date:** [July 4, 2022, 1:18pm UTC](https://forum.bubble.io/t/how-to-apply-a-condition-based-on-last-items-created-date/214000/1 "2022-07-04T13:18:04Z")

</div>

Hi There,

Hope everyone is well.

I am stuck a bit on a condition I am trying to apply using dates.

Basically I have a repeating group showing a list of clients, each client has a list of events.  
What I am trying to achieve is, when a client’s last event was created 12 hours or more ago from current date/time highlight the group red etc.

I have succeeded in applying the conditional state when the last items created date is simply smaller than current date however I cant figure out how to define the 12 hours (last items created date is 12 hours or more ago relative to current date)

Assitance appreciated!

---

<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:** [July 4, 2022, 1:24pm UTC](https://forum.bubble.io/t/how-to-apply-a-condition-based-on-last-items-created-date/214000/2 "2022-07-04T13:24:14Z")

</div>

when: `current cell's client's events: sorted by created date: descending yes: first item's created date < current date/time -12 hours`

---

<div class="post-metadata">

**Author:** ![rosewaterbrands](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@rosewaterbrands](https://forum.bubble.io/u/rosewaterbrands)\
**Post date:** [July 4, 2022, 1:29pm UTC](https://forum.bubble.io/t/how-to-apply-a-condition-based-on-last-items-created-date/214000/3 "2022-07-04T13:29:49Z")

</div>

Thanks for the response.

I have tried that but there is no option to (+ Hours) - 12) as there is normally when working with plain numbers

![image](https://us1.discourse-cdn.com/bubble/original/3X/f/2/f2b57890ed1aed896d0dc68b0d94d843205c9cf1.png)

---

<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:** [July 4, 2022, 1:42pm UTC](https://forum.bubble.io/t/how-to-apply-a-condition-based-on-last-items-created-date/214000/4 "2022-07-04T13:42:54Z")

</div>

Ah, you’ll need to turn on the experimental feature Parenthesis for it to work that way round…

Alternatively, turn the expression backwards and it should work (i.e. start with `current date/time - 12 hours > the event creation date`)

---

<div class="post-metadata">

**Author:** ![rosewaterbrands](https://avatars.discourse-cdn.com/v4/letter/r/bc8723/32.png) [@rosewaterbrands](https://forum.bubble.io/u/rosewaterbrands)\
**Post date:** [July 4, 2022, 1:59pm UTC](https://forum.bubble.io/t/how-to-apply-a-condition-based-on-last-items-created-date/214000/5 "2022-07-04T13:59:07Z")

</div>

Top Notch.

Thanks a mil. reversing the expression did the trick.
