# Expiration time

**URL:** <https://discuss.aerospike.com/t/expiration-time/4437>\
**Category:** User Defined Functions (UDF)\
**Created:** [July 28, 2017, 4:20am UTC](https://discuss.aerospike.com/t/expiration-time/4437 "2017-07-28T04:20:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxSum](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@MaxSum](https://discuss.aerospike.com/u/MaxSum)\
**Post date:** [July 28, 2017, 4:20am UTC](https://discuss.aerospike.com/t/expiration-time/4437/1 "2017-07-28T04:20:30Z")

</div>

Can I get expiration time value in Lua udf? It’s needed for more flexible TTL setting.

---

<div class="post-metadata">

**Author:** ![rbotzer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/rbotzer/32/2114_2.png) [@rbotzer](https://discuss.aerospike.com/u/rbotzer)\
**Post date:** [July 28, 2017, 5:03am UTC](https://discuss.aerospike.com/t/expiration-time/4437/2 "2017-07-28T05:03:08Z")

</div>

Yes, see the [Lua API reference](http://www.aerospike.com/docs/udf/api_reference.html) for all such details. The [record](http://www.aerospike.com/docs/udf/api/record.html) type has the functions `record.ttl(rec)` and `record.set_ttl(rec, ttl)`.

Example here on [how to modify the ttl](https://stackoverflow.com/questions/45193957/how-to-modify-the-ttl-of-all-records-set-with-a-ttl-of-1-in-aerospike/45193958#45193958) of records in a set.

---

<div class="post-metadata">

**Author:** ![MaxSum](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@MaxSum](https://discuss.aerospike.com/u/MaxSum)\
**Post date:** [July 28, 2017, 5:11am UTC](https://discuss.aerospike.com/t/expiration-time/4437/3 "2017-07-28T05:11:08Z")

</div>

Thanks, but it isn’t a expiration time. I want to know how long record will alive without any updates in current udf call. Java client receive this info from Record.expiration. I tried use last\_update\_time and current\_time for calculating this value, but decided to check, maybe this is already there

---

<div class="post-metadata">

**Author:** ![rbotzer](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/rbotzer/32/2114_2.png) [@rbotzer](https://discuss.aerospike.com/u/rbotzer)\
**Post date:** [July 28, 2017, 5:36am UTC](https://discuss.aerospike.com/t/expiration-time/4437/4 "2017-07-28T05:36:36Z")

</div>

It’s seconds into the future from _now_, so you can add that delta and find out the actual void time. Some clients give you the absolute value, and in some it’s seconds from now.

See: [http://www.aerospike.com/docs/udf/knowing\_lua.html](http://www.aerospike.com/docs/udf/knowing_lua.html)

---

<div class="post-metadata">

**Author:** ![MaxSum](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@MaxSum](https://discuss.aerospike.com/u/MaxSum)\
**Post date:** [July 28, 2017, 5:42am UTC](https://discuss.aerospike.com/t/expiration-time/4437/5 "2017-07-28T05:42:53Z")

</div>

Yep, thanks! I’m doing it now. This question for make sure that it isn’t existing out of the box
