Page 1 of 1

Help with getDate() and setting alarm

Posted: 04 Feb 2019 15:37
by icefox56
How to set an alarm like 15 minutes from current time in my alarm app?

I tried doing it. I put current time in a variable using getDate().
So that I can add 15 minutes to it using addMinutes(d, a)

But getDate() gives a value like 1549293097522. I have no clue how to interpret it.

I have no programming background. And my understanding of Variables and functions are very limited. So can someone please help me with this.

Re: Help with getDate() and setting alarm

Posted: 04 Feb 2019 17:47
by Desmanto
Time is expressed as miliseconds from epoch (1st January 1970). To show as proper date time, you must use dateformat. For example

Code: Select all

properdt = "{getDate(),dateformat,dd MMMM yyyy  HH:mm:ss}"
You can always add condition debug dialog after the script to check every available variables value at that point.

I am not sure if you want to clutter your alarm app with a lot of new alarm. Usually you can add alarm, but can't delete it. Better use Automagic default built-in trigger, Global Variable Date/Time as the alarm replacement. My Stay Awake Timer flow shows how to use it : viewtopic.php?f=3&t=7859

Re: Help with getDate() and setting alarm

Posted: 05 Feb 2019 09:49
by icefox56
Thanks for the reply @Desmanto,

I never thought of the deletion part. It would have been a real mess. I'll try out the Global Variable Date/Time trigger.

The flow you shared look super useful. I used to use a simple flow for setting screen on time. But I most likely forget to turn it off. Your flow is the solution. Thank you very much.