Help with getDate() and setting alarm

Post your questions and help other users.

Moderator: Martin

Post Reply
icefox56
Posts: 53
Joined: 15 Aug 2017 02:56

Help with getDate() and setting alarm

Post by icefox56 » 04 Feb 2019 15:37

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.
Asus Zenfone Max pro M1, Stock android, Oreo 8.1, Rooted

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Help with getDate() and setting alarm

Post by Desmanto » 04 Feb 2019 17:47

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
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

icefox56
Posts: 53
Joined: 15 Aug 2017 02:56

Re: Help with getDate() and setting alarm

Post by icefox56 » 05 Feb 2019 09:49

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.
Asus Zenfone Max pro M1, Stock android, Oreo 8.1, Rooted

Post Reply