# App functions with expiration date

**URL:** https://community.thunkable.com/t/app-functions-with-expiration-date/66544
**Category:** Questions about Thunkable X
**Created:** [January 28, 2019, 4:19pm UTC](https://community.thunkable.com/t/app-functions-with-expiration-date/66544 "2019-01-28T16:19:37Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![GUNALAN\_SUBRAMANIAM](https://avatars.discourse-cdn.com/v4/letter/g/b77776/32.png) [@GUNALAN\_SUBRAMANIAM](https://community.thunkable.com/u/GUNALAN_SUBRAMANIAM)
#### Post date: [January 28, 2019, 4:19pm UTC](https://community.thunkable.com/t/app-functions-with-expiration-date/66544/1 "2019-01-28T16:19:37Z")

</div>

How do I create an app that will have functions that will expire after certain time?

---

<div class="post-metadata">

### Author: ![Cian\_O\_Sullivan](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cian_o_sullivan/32/34494_2.png) [@Cian\_O\_Sullivan](https://community.thunkable.com/u/Cian_O_Sullivan)
#### Post date: [January 28, 2019, 4:48pm UTC](https://community.thunkable.com/t/app-functions-with-expiration-date/66544/2 "2019-01-28T16:48:38Z")

</div>

Is that a fixed time for all, or dependent on the user?

Anyway X does not get get time or date blocks so you need to get them from an API like

> **[TimeZoneDB](https://timezonedb.com/api)**
>
> Provides world time zone database download and API access.

Its free. What you do is setup a tinyDB, and then at the begining of each function have it check to see if it is valid or not based on the date that is stored in the DB. You can use a Web function to grab the current date. Format the data in the DB the same as you get it from the API, it will make it easy for you.

Try it out with a notify block as a test. On screen initialize get it to populate the notify block with the current time from the API.

---

<div class="post-metadata">

### Author: ![Kyle\_Williams](https://avatars.discourse-cdn.com/v4/letter/k/b2d939/32.png) [@Kyle\_Williams](https://community.thunkable.com/u/Kyle_Williams)
#### Post date: [January 28, 2019, 6:26pm UTC](https://community.thunkable.com/t/app-functions-with-expiration-date/66544/3 "2019-01-28T18:26:32Z")

</div>

They added date and time blocks in X recently. They are available in blocks, under “Device.”

---

<div class="post-metadata">

### Author: ![Cian\_O\_Sullivan](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cian_o_sullivan/32/34494_2.png) [@Cian\_O\_Sullivan](https://community.thunkable.com/u/Cian_O_Sullivan)
#### Post date: [January 28, 2019, 6:41pm UTC](https://community.thunkable.com/t/app-functions-with-expiration-date/66544/4 "2019-01-28T18:41:48Z")

</div>

I only see time blocks.

Converting seconds from 1970 to current time is complex. Thats why I suggested the API

---

<div class="post-metadata">

### Author: ![Kyle\_Williams](https://avatars.discourse-cdn.com/v4/letter/k/b2d939/32.png) [@Kyle\_Williams](https://community.thunkable.com/u/Kyle_Williams)
#### Post date: [January 28, 2019, 6:45pm UTC](https://community.thunkable.com/t/app-functions-with-expiration-date/66544/5 "2019-01-28T18:45:03Z")

</div>

There are also date blocks. Just drop one of the time blocks in and click the down arrow to see them.

Using Unix epoch calculations isn’t _that_ hard, and is much easier to compare times than evaluating date, then month, then year. Might be useful if the calculations only need to be done once, up front, rather than in the app.

Here is an example app that allows you to set the expiration date to Jan 1 2019 (expired) or Jan 1 2020 (active) and then test with another button to compare to current device time:  
[https://x.thunkable.com/copy/351faad1e32dcc32f7cdd53e93559e01](https://x.thunkable.com/copy/351faad1e32dcc32f7cdd53e93559e01)

**edit** [https://www.unixtimestamp.com/index.php](https://www.unixtimestamp.com/index.php) is how I got the unix timecodes used in the sample

---

<div class="post-metadata">

### Author: ![GUNALAN\_SUBRAMANIAM](https://avatars.discourse-cdn.com/v4/letter/g/b77776/32.png) [@GUNALAN\_SUBRAMANIAM](https://community.thunkable.com/u/GUNALAN_SUBRAMANIAM)
#### Post date: [January 29, 2019, 7:41am UTC](https://community.thunkable.com/t/app-functions-with-expiration-date/66544/6 "2019-01-29T07:41:07Z")

</div>

Thank you guys, will try and update

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 12:16pm UTC](https://community.thunkable.com/t/app-functions-with-expiration-date/66544/7 "2024-11-08T12:16:22Z")

</div>


