Hi all
I would know how to obtain current time in a flow. The only i have found is triggertime, but i need actual time in a my flow.
Thank you.
Current time in a flow?
Moderator: Martin
Re: Current time in a flow?
Have you seen this?
http://automagic4android.com/automagic/ ... terns.html
http://automagic4android.com/automagic/ ... terns.html
Re: Current time in a flow?
You can use the function getDate() to fetch the current system time when the function is invoked.
In a script something like this:
now = getDate();
or inline in a text field that supports variables (for example action Notification on Screen):
{getDate()}
or formatted:
{getDate(),dateformat,HH:mm:ss}
In a script something like this:
now = getDate();
or inline in a text field that supports variables (for example action Notification on Screen):
{getDate()}
or formatted:
{getDate(),dateformat,HH:mm:ss}
Re: Current time in a flow?
Thank you!Martin wrote:You can use the function getDate() to fetch the current system time when the function is invoked.
In a script something like this:
now = getDate();
or inline in a text field that supports variables (for example action Notification on Screen):
{getDate()}
or formatted:
{getDate(),dateformat,HH:mm:ss}
I will try as soon as possible.
Re: Current time in a flow?
Hi MartinMartin wrote:You can use the function getDate() to fetch the current system time when the function is invoked.
In a script something like this:
now = getDate();
or inline in a text field that supports variables (for example action Notification on Screen):
{getDate()}
or formatted:
{getDate(),dateformat,HH:mm:ss}
this work well.
I have another need but i can't figure out on how to do this:
i would do a calculation between two times (in HH:mm). I mean the difference between two times, example:
triggertime 08:40, current time 13:10: can i obtain the difference (in this example 04HH:30mm)?
Thank you
Re: Current time in a flow?
triggertime is a number containing the milliseconds since 1970. getDate() also returns milliseconds since 1970.
You can calculate the difference to get the duration in millis (in an action Script):
diff = getDate() - triggertime;
and formatted to the duration format often used in Automagic:
formatted = getDurationString(diff);//for example 5s 30ms
or combined:
formatted = getDurationString(getDate() - triggertime);
You can calculate the difference to get the duration in millis (in an action Script):
diff = getDate() - triggertime;
and formatted to the duration format often used in Automagic:
formatted = getDurationString(diff);//for example 5s 30ms
or combined:
formatted = getDurationString(getDate() - triggertime);