# Telegram service - embedding rule variable

**URL:** <https://community.openhab.org/t/telegram-service-embedding-rule-variable/97140>\
**Category:** Scripts & Rules\
**Tags:** rules, telegram, binding\
**Created:** [April 21, 2020, 6:56am UTC](https://community.openhab.org/t/telegram-service-embedding-rule-variable/97140 "2020-04-21T06:56:41Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![5iver](https://community.openhab.org/user_avatar/community.openhab.org/5iver/32/21201_2.png) [@5iver](https://community.openhab.org/u/5iver)\
**Post date:** [April 21, 2020, 9:12am UTC](https://community.openhab.org/t/telegram-service-embedding-rule-variable/97140/3 "2020-04-21T09:12:21Z")

</div>

Not that there is anything wrong with how you are putting the numbers together, but if you’d like to prepare for OH 3.0 (no Joda), you could use ZoneDateTime and [ChronoUnit](https://community.openhab.org/t/solved-rules-calculate-difference-between-2-datetime-in-minutes/91553/4).

```auto
import java.time.temporal.ChronoUnit
... 
val prevOnState = TTNseawTemp_LastUpdate.getStateAs(DateTimeType).zonedDateTime.until((new DateTimeType).zonedDateTime, ChronoUnit.MINUTES)

```

---

_[View the full topic](https://community.openhab.org/t/telegram-service-embedding-rule-variable/97140)._
