How do I create an app that will have functions that will expire after certain time?
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
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.
They added date and time blocks in X recently. They are available in blocks, under “Device.”
I only see time blocks.
Converting seconds from 1970 to current time is complex. Thats why I suggested the API
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:
edit https://www.unixtimestamp.com/index.php is how I got the unix timecodes used in the sample
Thank you guys, will try and update