# \[Scènes\] Comparing a timestamp to the current date/time or to “today”

**URL:** <https://community.gladysassistant.com/t/scenes-comparer-un-timestamp-a-la-date-heure-actuelle-ou-a-aujourd-hui/10646>\
**Category:** Demandes livrées\
**Created:** [August 17, 2026, 2:17pm UTC](https://community.gladysassistant.com/t/scenes-comparer-un-timestamp-a-la-date-heure-actuelle-ou-a-aujourd-hui/10646 "2026-08-17T14:17:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [August 17, 2026, 2:17pm UTC](https://community.gladysassistant.com/t/scenes-comparer-un-timestamp-a-la-date-heure-actuelle-ou-a-aujourd-hui/10646/1 "2026-08-17T14:17:41Z")

</div>

Hello,

I am currently working on a Roborock integration that can expose the date of the last cleaning as a timestamp.

The goal is then to be able to build a scene of the type:

```auto
When the house becomes empty
→ retrieve the last cleaning of the robot
→ continue only if no cleaning has been done today
→ start cleaning

```

The integration can easily expose:

```auto
Last clean start = 1786958400

```

The problem is that at the scene engine level, it does not seem possible to simply compare this value with a relative date such as:

```auto
beginning of today
today
now
yesterday
X hours ago

```

A condition like this would be particularly useful:

```auto
Last clean < beginning of today

```

or, more ergonomically:

```auto
Last clean
→ is not today

```

The idea would therefore be to add generic support for dates/timestamps in scene conditions.

```auto
timestamp < now
timestamp > startOfDay
timestamp > now - 24h
timestamp isToday
timestamp isYesterday

```

This could eventually go through scene variables/formulas, for example by exposing values or functions like:

```auto
now()
today()
startOfDay()
endOfDay()

```

The need is not specific to Roborock. This would also allow working with:

- date of the last movement;
- last opening of a door;
- last startup of a device;
- last recharge;
- last event from an integration;
- any device exposing a timestamp.

In my specific case, this would avoid adding a feature `cleaned_today` in the Roborock integration, while the generic information `last_clean_start` is normally sufficient.

Would this be something that could fit in the scene engine?

---

<div class="post-metadata">

**Author:** ![StephaneB](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/stephaneb/32/15443_2.png) [@StephaneB](https://community.gladysassistant.com/u/StephaneB)\
**Post date:** [August 17, 2026, 3:01pm UTC](https://community.gladysassistant.com/t/scenes-comparer-un-timestamp-a-la-date-heure-actuelle-ou-a-aujourd-hui/10646/2 "2026-08-17T15:01:37Z")

</div>

Will the following request, accepted by Pierre-Gilles, allow you to meet your needs?

> [@Retrieve the date and time in a scene](https://community.gladysassistant.com/t/recuperer-la-date-et-lheure-dans-une-scene/8821):
>
> Feature description Following this thread: [Récuperer date/heure dans mqtt - #3 par prohand](https://community.gladysassistant.com/t/recuperer-date-heure-dans-mqtt/8819/3) I think it would be nice to be able to retrieve the time locally in a scene and not via an external web service slight_smile

---

<div class="post-metadata">

**Author:** ![spenceur](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/spenceur/32/1961_2.png) [@spenceur](https://community.gladysassistant.com/u/spenceur)\
**Post date:** [August 17, 2026, 3:18pm UTC](https://community.gladysassistant.com/t/scenes-comparer-un-timestamp-a-la-date-heure-actuelle-ou-a-aujourd-hui/10646/3 "2026-08-17T15:18:30Z")

</div>

Hey @StephaneB

Yes, this request seems to cover a large part of my needs 👍

In my case, the Roborock integration directly exposes the timestamp of the start of the last cleaning (`last_clean_start`). Therefore, I don’t need to store the current time at the time of an event, but I need to be able to compare this timestamp with the current date in a scene.

For example: `last_clean_start < start of today`, to know that no cleaning has been started yet today.

If the feature proposed in this topic allows both to retrieve `now`/today’s date **and to make comparisons or calculations with a timestamp from a feature** , then yes, it would meet my needs.

The two requests could probably be grouped around generic support for dates/timestamps in scenes. 🙂

---

<div class="post-metadata">

**Author:** ![cursor-bot](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cursor-bot/32/22252_2.png) [@cursor-bot](https://community.gladysassistant.com/u/cursor-bot)\
**Post date:** [October 29, 2026, 10:48am UTC](https://community.gladysassistant.com/t/scenes-comparer-un-timestamp-a-la-date-heure-actuelle-ou-a-aujourd-hui/10646/4 "2026-10-29T10:48:06Z")

</div>

Hi @spenceur!

Since Gladys 5.0, a scene can **Retrieve the current date and time**. The action provides a timestamp, which can be reused later.

To compare to “today,” the day precision corresponds to the start of the day. Then, a **Condition on variables** compares the timestamp of the last cleaning to that of the day. If it is older, the scene launches the robot.

This covers the scenario in the topic: the house is empty, you read the date of the last pass, you only launch the robot if it hasn’t already passed today.

I’m moving this topic to “Delivered requests.” If there’s still a case that doesn’t fit, open a new topic: it will be easier to follow.

---

<div class="post-metadata">

**Author:** ![cursor-bot](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cursor-bot/32/22252_2.png) [@cursor-bot](https://community.gladysassistant.com/u/cursor-bot)\
**Post date:** [October 29, 2026, 10:48am UTC](https://community.gladysassistant.com/t/scenes-comparer-un-timestamp-a-la-date-heure-actuelle-ou-a-aujourd-hui/10646/5 "2026-10-29T10:48:11Z")

</div>


